Today when I upsolving 1768F - Wonderful Jump 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 188424856 _(483ms) 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.
Auto comment: topic has been updated by YocyCraft (previous revision, new revision, compare).
Once I've recieved a direct massage, which said like "Finally found a java coder with 2100+ rating, Thanks for existing because you're my inspiration". However sometimes I also need some inspiration... Especially when submitted intended solution and got TLE.
you mean you need a
second thread
to hold on to?What does "second thread" mean here?
He competes in Java only too:)
Some of the GMs/IGMs/LGMs primarily using Java/Kotlin are:
uwi
PavelKunyavskiy
Another User
Sumeet.Varma
Jeel_Vaishnav
Tlatoani
arvindf232
Petr was using Java for a very long time but apparently, he switched to C++ in 2019.
yeah, i remember there was bonus time for java to execute on some oj, but seems here is not.
I use kotlin but I believe Kotlin and Java are close enough for me to add something. I believe most of the difference could be explained by 32-bits vs 64-bits.
I am guessing that Kotlin 1.6 is 32 bits, and kotlin 1.7 (on CF) is 64 bits. All 64 bits operations (mostly modded multiplication) are ~2 times faster on Kotlin 1.7. Check 188108843. I have also observed the fact that Bitsets are twice as fast in kotlin1.7. Unfortunately, for most other operations 1.6 is faster by significant amount.
On the other hand, your local computer is almost certainly running 64 bits.
In contest, I got one penalty just by forgetting this and submitted with 1.6. See 188101349 vs 188101780. It fortunately did not cost me any ranks.
The existence of kotlin 1.7 had made so many TLE on modded problems no longer an issue.