javacoder1's blog

By javacoder1, history, 8 years ago, In English

I was solving this question http://mirror.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://mirror.codeforces.com/contest/696/submission/19464350

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

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

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://mirror.codeforces.com/contest/696/submission/19466125

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

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.