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 <iostream>
#include <vector>
#include <map>
using namespace std;
int main() {
int H, V;
cin >> H >> V;
vector<int> A(H), B(V);
for (int i=0; i<H; ++i) cin >> A[i];
for (int i=0; i<V; ++i) cin >> B[i];
map<int,int> cnt;
for (int i=0; i<H; ++i) for (int j=0; j<i; ++j) cnt[ A[i]-A[j] ]++;
long long res = 0;
for (int i=0; i<V; ++i) for (int j=0; j<i; ++j) res += cnt[ B[i]-B[j] ];
cout << res << 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... |