This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define f first
#define s second
using namespace std;
using ll = long long;
using pii = pair <int, int>;
const int N = 2e3 + 5;
int h, v, x[N], y[N];
int main() {
ios :: sync_with_stdio(0);
cin.tie(0);
cin >> h >> v;
map <int, int> cnt;
for (int i = 1; i <= h; ++i) {
cin >> x[i];
for (int j = i - 1; j > 0; j--) {
cnt[x[i] - x[j]]++;
}
}
int ans = 0;
for (int i = 1; i <= v; ++i) {
cin >> y[i];
for (int j = i - 1; j > 0; j--) {
ans += cnt[y[i] - y[j]];
}
}
cout << ans;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |