Corner Test cases are running ok but after submitting getting wrong answer fault. Kindly help.
#include
using namespace std;
int main() {
//declaring variables T denotes test cases, s1 & s2 to hold score of each round, cs1 & cs2 are for
cumulative scores.
int T=0,s1=0,s2=0,cs1=0,cs2=0,max=0,index=0;
cin >> T;
//arr1 is to hold lead of each round, arr2 for holding winner of each round ( 1 or 2)
int arr1[T]={0},arr2[T]={0};
for(int i=0;i<T;i++){
cin >>s1;
cin >>s2;
cs1=cs1+s1;
cs2=cs2+s2;
if(cs1>cs2){
arr1[i]=cs1-cs2;
arr2[i]=1;
}
else{
arr1[i]=cs2-cs1;
arr2[i]=2;
}
}
max=arr1[0];
//finding the index of max lead
for(int i=0;i<T;i++)
{
if(arr1[i]>max)
index=i;
}
cout << arr2[index] <<" " << arr1[index]<<"\n";
return 0;
}Preformatted text