it’s an easy problem. the logic behind this problem is to count number of goals for both team after every shootout and when one of them has no more chance to shoot goals and compensate the difference in goals of two team.

for example

let there are 6 total penalty shootout

after 4 penalty shootout team A do 4 goals and team B do 0 goal now both team has to more chances to shoot but even then B cant compensate the difference between the goals and lose the match so at 4 we know which team wins in advance so answer is 4.

this is code for problem

```
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
for(int i=0;i<t;i++)
{
string s;
int n;
cin>>n;
cin>>s;
int a=0,b=0,c=0;
int counta=0,countb=0;
for(int j =0;j<2*n;j++)
{
if(j%2==0)
{ counta++;
if(s[j]=='1')
{a++;}
}
else if(j%2!=0)
{countb++;
if(s[j]=='1')
{b++;}
}
if(a-b>n-countb)
{cout<<j+1<<endl;
c=1;
break;
}
if(b-a>n-counta)
{cout<<j+1<<endl;
c = 1;
break;
}
}
if(c==0)
{cout<<2*n<<endl;}
}
return 0;
}
```