Being a Java Programmer, I am requesting the admin and MikeMirzayanov to kindly provide latest versions of Java like Java 14.
There are many bugs in the versions of Java-11 and Java-8, which are the versions provided by codeforces, for submitting a problem in Java. For example the Arrays.sort() functionality for primitive date-types like int and long can be easily hacked giving tle. However, for a person like me when I test my corresponding code in my Java-14 compiler it produces absolutely no tle for the same test-case.
Similarly, few of my solutions execute to tle while the same solution in cpp passes all the tests without any problems. To check I tried to execute a test-case in my compiler that ran in 1.8s while for the same test and same code the time taken by the Java-11 compiler in codeforces custom-invocation is 4.8s.
Here is the link to the problems for my
-> Java solution https://codeforces.net/contest/1487/submission/107445101 , and
-> cpp solution https://codeforces.net/contest/1487/submission/107471156.
If you check both absolutely have the same logic in the main function. But yet there are different results. I have also faced this issue while participating in many rated contest.
Hence, I will request the admins and MikeMirzayanov to please provide a solution for the Java programmers by providing a much later version of Java.
Yours faithfully...
Auto comment: topic has been updated by soumit915 (previous revision, new revision, compare).
It's not the java compilers fault, your code is written badly. Even C++ took nearly 1.8 seconds. It will get TLE in almost every language except C++.
I know that for that code a more optimised algorithm can be used... but in my compiler the code took 1.8 secs to run while the codeforces Java-11 compiler took nearly 4.8secs to run for the same test-case. And also there are lot of bugs with Arrays.sort() and many other in-built functions so I requested for a latest compiler. Since, there are already latest compiler already available for cpp .