做题时我只考虑了两个点分别在左上和右下角的特殊情况,当点在左下和右上角时答案错误
#include <iostream>
using namespace std;
const int N = 200010;
int dist[N];
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i ++) {
int a, b;
cin >> a >> b;
dist[i] = a + b;
}
int mind = 2e9 + 10, maxd = 0;
for (int i = 0; i < n; i ++) {
maxd = max(maxd, dist[i]);
mind = min(mind, dist[i]);
}
cout << maxd - mind <<endl;
return 0;
}