Please help in resolving wrong Answer

Contest-DSA Learning Series Week-2
Problem-CodeChef: Practical coding for everyone

Can anyone help me in finding out why this code is giving wrong answer?
#include<bits/stdc++.h>
#include<string.h>

using namespace std;

int main()

{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin>>t;
while(t–)
{
int i,n;
cin>>n;
string s;
cin>>s;
int chances=n;
int result=2*n;

  int a_score=0,b_score=0;
  for(i=0;i<2*n;i+=2)
  {
     if( a_score>b_score+chances || b_score>a_score+chances)
     {
        result=i;
        break;
     }
    
    a_score+=int(s[i])-'0';
    b_score+=int(s[i+1])-'0';
    chances-=1;
  }
  cout<<result<<endl;

}

}

You are checking if the game is over after every two shots (one from A and one from B).
Try doing it after every shot.

int chances_a=n;
int chances_b=n;
....
....
for(i=0;i<2*n;i++)
{
   if(a_score > b_score+chances_b || b_score > a_score+chances_a)
   {..  .. ..}
   if(i%2==0)
      { a_score += int(s[i])-'0';
        chances_a--; }
   else
      { b_score += int(s[i])-'0';
        chances_b--; }
}