My issue
This code which I wrote seems correct, it is also able to pass all the custom test cases, why is it not accepted in the IDE, it always shows Wrong answer on submitting. I also tried one code in which I didn’t used array and solved it, and that too was able to pass all the test cases, that too wasn’t accepted, what is the issue, kindly check.
Do we need to type exactly same code?
My code
// Update your code below to solve the problem
#include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
while(t--){
int T1=0, T2=0;
int A[10];
for(int i = 0; i < 10; i++){
cin >> A[i];
}
for(int i = 0; i<10; i++){
if(i<5){
if(A[i] == 1)
T1 = T1+1;
}
else{
if(A[i] == 1)
T2= T2+1;
}
}
if(T1 == T2){
cout << 0 << endl;
}
else if(T1 > T2){
cout << 1 << endl;
}
else{
cout << 2 << endl;
}
}
}
Learning course: C++ for problem solving - 2
Problem Link: CodeChef: Practical coding for everyone