Блог пользователя phantom11

Автор phantom11, 15 лет назад, По-английски

I cant understand whats the problem with test case 66(n=10^5 k=1).It gives TLE. During the contest I submitted this code and it gives TLE in 66. After the contest when I saw the test case ,I put a condition of checking if k=1 for immediate passing ,just to see if it worked,and it again gave TLE(code). I used BufferedReader to check if its because of large inputs,but again TLE(code). And its not only me but many who got TLE in 66 using java(see this page). Please tell me where is it going wrong because in test case 65 also n=10^5,k=1 so it cant be a sorting issue or a input issue...But immediately after reading inputs and sorting I am displaying the result for k=1.Then why is it passing for 65 and failing for 66.

  • Проголосовать: нравится
  • -3
  • Проголосовать: не нравится

»
15 лет назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

Try to generate the test using this program: http://pastie.org/2222386

»
15 лет назад, скрыть # |
 
Проголосовать: нравится +4 Проголосовать: не нравится

again for java coders: implementation of Arrays.sort is QuickSort which is hackable with special input data, causing Arrays.sort work O(N^2) time. be carefull: shuffle array before sort or use Collections.sort or self written merge sort, good luck

»
15 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Was the Anti-Quicksort factor working because the time limit was 1sec..Could it have passed if time limit was 2 sec??