knightandking's blog

By knightandking, history, 3 years ago, In English

My solution (submission link) is getting the time limit exceeded while on test case 34 while being virtually identical to the editorial solution. I tried a bunch of changes but non seem to be working

  • Vote: I like it
  • +3
  • Vote: I do not like it

| Write comment?
»
3 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Use map instead of unordered_map

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

It might be because of overflow in the binary search(the max value is 5e9, and 5e9*5e9 = 25e18, which will overflow beyond even unsigned long long). I suggest changing it to 3e9, which is enough and will not overflow.

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

use map