Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

Блог пользователя ronaldocr7

Автор ronaldocr7, история, 5 лет назад, По-английски

contest :-- https://codeforces.net/contest/1174 question 2nd link :-- https://codeforces.net/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;

  • Проголосовать: нравится
  • -10
  • Проголосовать: не нравится

»
5 лет назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

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

»
5 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

I used smth like:

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

tests were ok.

»
5 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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

  • »
    »
    5 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

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