contest :-- https://mirror.codeforces.com/contest/1174 question 2nd link :-- https://mirror.codeforces.com/contest/1174/problem/B
I have the same logic like various other contestants have used but I got TLE on test case number 63 as i had used JAVA whereas others have used C++. this is a very disappointing for me and i am not getting the logic behind this. Everyone knows that JAVA is bit slow than C++ but this is not acceptable that u change your logic or thinking process on this fact My submitted cod is 55027519: please anyone explain me why this happened;
Because Java .sort is O(N^2) in worst case.
then what should i do in this scenario; should i think of switching langugage because what can u do inspite of using the built in sort function. don't site should take this into consideration before setting time limits
You should know about this already if you use Java.It is well-known issue.There are many blogs about that.You should read this. Hope you learned something :D https://mirror.codeforces.com/blog/entry/7108
got it accepted just using changing datatype of array from (int) to (Integer).
thank you TselmegKh
I used smth like:
List sequence = Arrays.asList(a); Collections.sort(sequence);
tests were ok.
I to got a TLE. So we are supposed to use Wrapper class. huh!!
yah i got accepted using Wrapper Class [submission:https://mirror.codeforces.com/contest/1174/submission/55051982]