Maybe it's the limitation of the programming language?

Правка en1, от YocyCraft, 2023-01-11 19:52:25

Today when I upsolving 1775F - Laboratory on Pluto in which the intended solution is pretty simple. But the time complexity is O(n^1.5) and n=4*10^5 the time limit is pretty strict. I implemented the intended solution in java for many times but I always got TLE. Then I copied the submission submission:188424856 which is simpler the the official solution, and implemented in java, and got AC for 3322ms (My submission:188904779). It seems that sometimes you must to optimize the solution further than intended.

Also the official judge runs java code much more slowly than on my computer. I tested for cases where a[i]=1+(i%mod), where mod was about sqrt(400000). The code ran for about 0.6s but for the similar cases of the official judge it ran for about 2.3s.

The code for testing time cost on my computer

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en4 Английский YocyCraft 2023-01-11 19:57:37 4 Tiny change: 'problem:1775F] in whic' -> 'problem:1768F] in whic'
en3 Английский YocyCraft 2023-01-11 19:56:51 1 Tiny change: '88424856] (483ms) wh' -> '88424856] _(483ms) wh'
en2 Английский YocyCraft 2023-01-11 19:54:59 24 Tiny change: '.util.*;\nimport java.io.*;\npublic c' -> '.util.*;\n\nimport java.io.*;\n\npublic c'
en1 Английский YocyCraft 2023-01-11 19:52:25 2842 Initial revision (published)