javacoder1's blog

By javacoder1, history, 9 years ago, In English

Hey i am getting tle on test 66. My code: Please anyone suggest any optimization http://mirror.codeforces.com/contest/229/submission/14839811

  • Vote: I like it
  • 0
  • Vote: I do not like it

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

In function ll get_num(.., ..) u have following code

while(pos<(int)arrive[node].size() && arrive[node][pos]==time)
{
    pos++;time++;
}

In some cases get_sum() would work in linear time cause of this while.

So just replace it with binsearch or smth, i got AC this way with 0.7s