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

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

I was solving this question http://codeforces.com/problemset/problem/696/E and my code is passsing in less than a second int max test cases as in test case 10 but it is giving TLE in test case 14 where there is a single node.I am unable to find where it is getting TLE. someone please help and please do not down vote as i have been caught for a while. My submission: http://codeforces.com/contest/696/submission/19464350

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

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

It was erasing from vector which was creating problems on replacing it with deque it is now getting TLE on test 36 again a max case while in others max cases it is passing in a second .Please someone help submission: http://codeforces.com/contest/696/submission/19466125

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

GOT AC. Seemed the problem was in this line. I sorted the vector and the operation v.erase(v.begin()) was the cause of TLE. REplacing it with set and deque passed . Can someone explain the vector part.