sguu's blog

By sguu, history, 6 years ago, In English

Got AC for :https://www.ideone.com/PCX6n1

but WA for :https://www.ideone.com/tYQwiR

why? both seems same binary search

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

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

In the AC one, when ans equals 1, it prints v[0], but in the WA one, it prints -1. I think the condition should be (ans != -1) not (ans != 1).