# Help me in solving AOCV208 problem

### My issue

My output is showing wrong but it is right when compared with all the conditions…Please help me I’m unable to move forward

### My code

``````// Update your code below to solve the problem

#include <bits/stdc++.h>
using namespace std;

int main()
{
int t;
cin >> t;
int F=0;
int S=0;
while(t--)
{
int A;
for(int i = 0; i < 10; i++)
{
cin >> A[i];
}
for(int i=0; i<5; i++)
{
if(A[i] == 1)
{
F=F+1;
}
}
for(int i=5; i<10; i++)
{
if(A[i] == 1)
{
S=S+1;
}
}
if(F == S)
{
cout<<0<<endl;
}
else if(F > S)
{
cout<<1<<endl;
}
else
{
cout<<2<<endl;
}

}
}

``````

Learning course: C++ for problem solving - 2
Problem Link: CodeChef: Practical coding for everyone

@ygouripriya
You should have read the problem statement more thoroughly.

In the problem statement it is given that scoring starts with team 1 and will alternate for team 2 for next value, then again for team1 and so on.

In your code, you are just taking first 5 and last 5 values then comparing the sum which is not correct.

Here is my code for reference;

``````// Update your code below to solve the problem

#include <bits/stdc++.h>
using namespace std;

int main()
{
int t;
cin >> t;

while(t--)
{
int A,t1=0,t2=0;
for(int i = 0; i < 10; i++)
{
cin >> A[i];
if(i%2==0)
{
t1=t1+A[i];
}
else
{
t2=t2+A[i];
}
}
if(t1>t2)
{
cout<<1<<endl;
}
else if(t1==t2)
{
cout<<0<<endl;
}
else
{
cout<<2<<endl;
}
}
}

``````