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>
using namespace std;
int main(){
cin.tie(0)->sync_with_stdio(0);
int h, v; cin >> h >> v;
map<int, int> m, n;
vector<int> a(h), b(v);
for(int& i:a) cin >> i;
for(int& i:b) cin >> i;
for(int i=0; i<h; ++i) for(int j=i+1; j<h; ++j) ++m[a[j]-a[i]];
for(int i=0; i<v; ++i) for(int j=i+1; j<v; ++j) ++n[b[j]-b[i]];
int ans = 0;
for(auto& i:m) ans += i.second * n[i.first];
cout << ans << endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |