Wrong answer when it is running perfectly on my ide also ttl shows 5 seconds it was my first question attempt

#include
#include

using namespace std;

int main()
{
ios_base::sync_with_stdio(0);
long long int n ,a , b, L;
int W;
cin>>n;
map<int,int>score;
score.insert({1,0});
score.insert({2,0});
for(int i = 0; i < n; i++)

 {
    cin>>a>>b;
    if(a>b)
    {
       L = a - b;
       if(L > score[1])
        {
            score[1] = L;
        }
    }
    else
        {

        L = b - a;
        if(L > score[2])
        {
            score[2] = L;
        }
    }
 }
 if(score[1] > score[2])
 {  W = 1;
     cout<<W<<" "<<score[1];
 }
 else{
        W =2;
    cout<<W<<" "<<score[2];}
 return 0;

}

Please read this.

6 Likes

thnnx