Prophet123's blog

By Prophet123, history, 5 years ago, In English

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://codeforces.me/contest/1341/problem/C My solution- https://codeforces.me/contest/1341/submission/77847675

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

»
5 years ago, # |
Rev. 4   Vote: I like it 0 Vote: I do not like it

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.