kira..04's blog

By kira..04, 3 months ago, In English

i was trying to solve this problem and i got tle on test 12

why ?

https://codeforces.me/contest/939/submission/277938020

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

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

There are two likely cases here:

  1. Your binary search never terminates

  2. You used more than 7 query (I think this is likely since you're doing ternary search wrong)

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

You have in your code while(l <= r). This loop will never end.