#include <iostream>#include <cmath>using namespace std;int main(){int n;cin >> n;int p1s = 0, p2s = 0, x, y;int p1l = 0, p2l = 0;while(n--){cin >> x >> y;p1s += x;p2s += y;int t = abs(p1s-p2s);if(p1s > p2s){if(t > p1l)p1l = t;}else{
Read more…
#include <iostream>#include <cmath>using namespace std;int main(){int n;cin >> n;int p1s = 0, p2s = 0, x, y;int p1l = 0, p2l = 0;while(n--){cin >> x >> y;p1s += x;p2s += y;int t = abs(p1s-p2s);if(p1s > p2s){if(t > p1l)p1l = t;}else{