Блог пользователя Prophet123

Автор Prophet123, история, 5 лет назад, По-английски

I am not able to figure out the test case for which my code gives the wrong answer. Can anybody help me out on this one. Thanks in advance.

Problem link- https://mirror.codeforces.com/contest/1341/problem/C My solution- https://mirror.codeforces.com/contest/1341/submission/77847675

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
5 лет назад, # |
Rev. 4   Проголосовать: нравится 0 Проголосовать: не нравится

while(ind<=pos&&i<=n){ //cout<<i<<" "; if(mp[i]!=ind){ flag=1; break; } i++,ind++; } After the last mp[i] == ind and ind <= pos and i <= n, you will make i + 1. So you will take number, you need. But later you will make one more i + 1. I think problem is here.

UPD: Try to solve this problem with cycle WHILE.