Can aybody help me with TLE..?? :(

Revision en1, by OneClickAC, 2016-12-31 14:01:40

Hi Reader,

I just wrote the solution for this problem (710-B) in Java and I just don`t know that why i am getting a TLE verdict.. Problem link -> http://codeforces.com/contest/710/problem/B The real reason to worry is that my code is passing one of the tests (where value of n is 300000) but is getting a verdict of TLE where (n is equal to 299999) .. How can this be posssible ?? I have used basic inbuilt sorting algorithm in Java and then one more step of O(n) complexity . So if n is larger , time will also be larger. As it will be directly proportional to O(n) or O(nlogn).. What is the reason behing this , that time is larger in latter case?? Infact , I then solved the problem in C++ where no such unexpected activity is happening and i passed all tests ..

Please help me out with this !! This is my code -> http://pastebin.com/DfYg30zj This is my submission link -> http://codeforces.com/contest/710/submission/23467650

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English OneClickAC 2016-12-31 14:01:40 979 Initial revision (published)