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;
#define int long long
int32_t main(){
int h, v; cin >> h >> v;
map<int, int> m1, m2;
vector<int> v1(h), v2(v);
for(int& i:v1) cin >> i;
for(int& i:v2) cin >> i;
for(int i=0; i<h; ++i){
for(int j=i+1; j<h; ++j) ++m1[v1[j]-v1[i]];
}
for(int i=0; i<v; ++i){
for(int j=i+1; j<v; ++j) ++m2[v2[j]-v2[i]];
}
int ans = 0;
for(auto i:m1) ans += i.second * m2[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... |