I am facing difficulties in TLG problem , it is running on test case that is given input

#include
using namespace std;

int main() {
// your code goes here

	// your code goes here
int i,t,a[t],b[t],diff[t],res = 0;
cin>>t;
for(i = 0;i<t ; i++)
{
    cin>>a[i]>>b[i];
}
for(i=0 ; i<t ; i++)
{
    if(a[i]>b[i])
    {
        diff[i] = a[i] - b[i];
    }
    else
    {
        diff[i] = b[i] - a[i];
    }
    
}
for(i=0 ; i<t ; i++)
{
    res = max(res , diff[i]);
    
}
for(i=0 ; i<t ; i++)
{
    if(a[i]-b[i] == res)
    {
        cout<<1<<endl;
        break;
    }
    else if(b[i]-a[i] == res)
    {
        cout<<2<<endl;
        break;
    }
    
}
cout<<res;


return 0;

}

Please either format your code or (better!) link to your submission - the forum software has mangled it and it won’t compile! :slight_smile:

1 Like