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

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

I am using an approach that will work within the time limit and even the same approach is accepted in C++ but gives TLE in java I have also used Fast IO but still TLE. Can anyone help me with this. Problem Link : https://mirror.codeforces.com/contest/986/problem/A Submission : https://mirror.codeforces.com/contest/986/submission/132535284

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

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

even the same approach is accepted in C++

Did you try implementing your approach in C++ then?

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

You're using linked list and accessing random indices, therefore it becomes n^2 and is way too slow