没啥好说的,萌新第一次敲题解,dalao帮帮忙 ACcode:

#include <map>
using namespace std;
int x[1005], y[1005];
int n, max_n = 0;
int max_num(int b1, int b2) {
    int cnt = 0;
    for (int i = 0; i < n; i++) {
        if (x[i] + y[i] == b1 || y[i] - x[i] == b2) {
            cnt++;
        }
    }
    return cnt;
}

int main() {

    map<int, int> m1, m2;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> x[i];
    }
    for (int i = 0; i < n; i++) {
        cin >> y[i];
    }
    
    for (int i = 0; i < n; i++) {
        m1[x[i] + y[i]]++;
        m2[y[i] - x[i]]++;
    }
    for (auto it1 = m1.begin(); it1 != m1.end(); it1++) {
        for (auto it2 = m2.begin(); it2 != m2.end(); it2++) {
            max_n = max(max_n, max_num(it1->first, it2->first));
        }
    }
    cout << max_n;
}