Hello,
I need help with the TLG Practice Problem.
Seems pretty simple, but when I submit the code I always get back the “Wrong Answer” error.
This is my code:
#include <iostream>
using namespace std;
int main() {
int N;
int L = 0; // this is the lead
int W; // this indicates the winner
scanf("%d", &N);
while (N--) {
int Si, Ti;
scanf("%d %d", &Si, &Ti); //scanning scores
int diff; // difference between scores
if (Si > Ti) {
diff = Si - Ti;
if(diff > L) {
L = diff;
W = 1;
}
} else {
diff = Ti - Si;
if(diff > L) {
L = diff;
W = 2;
}
}
}
printf("%d %d\n", W, L);
return 0;
}
Thank you in advance for your help!