My code:
#include <bits/stdc++.h>
using namespace std;
#define F0R(i, a) for (int i=0; i<a; i++)
int N;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> N;
int p1Score = 0;
int maxDiff = 0;
int p2Score = 0;
int score1, score2;
F0R(i, N){
cin >> score1 >> score2;
p1Score += score1;
p2Score += score2;
if(abs(p1Score-p2Score) > abs(maxDiff)){
maxDiff = p1Score - p2Score;
}
}
if(maxDiff < 0) cout << 2 << " ";
else cout << 1 << " ";
cout << abs(maxDiff) << "\n";
return 0;
}
Read more… (94 words)