kira..04's blog

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

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

why ?

https://mirror.codeforces.com/contest/939/submission/277938020

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

»
3 hours 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 hours 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.