ronaldocr7's blog

By ronaldocr7, history, 5 years ago, In English

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;

  • Vote: I like it
  • -10
  • Vote: I do not like it

| Write comment?
»
5 years ago, # |
  Vote: I like it +1 Vote: I do not like it

Because Java .sort is O(N^2) in worst case.

  • »
    »
    5 years ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    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

»
5 years ago, # |
  Vote: I like it 0 Vote: I do not like it

I used smth like:

List sequence = Arrays.asList(a); Collections.sort(sequence);

tests were ok.

»
5 years ago, # |
  Vote: I like it 0 Vote: I do not like it

I to got a TLE. So we are supposed to use Wrapper class. huh!!

  • »
    »
    5 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    yah i got accepted using Wrapper Class [submission:https://mirror.codeforces.com/contest/1174/submission/55051982]