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 loop(i, a, b) for(long long i=a;i<b;i++)
#define pool(i, a, b) for(long long i=a-1;i>=b;i--)
#define fore(i, a) for(auto&& i:a)
#define ll long long
using namespace std;
ll a[1600], b[1600];
map<ll, ll> neki;
int main(){
ll h, v;cin >> h >> v;
loop(i, 0, h) cin >> a[i];
loop(i, 0, v) cin >> b[i];
loop(i, 0, h){
loop(j, 0, i){
neki[a[i]-a[j]]++;
}
}
ll ans=0;
loop(i, 0, v){
loop(j, 0, i){
ans+=neki[b[i]-b[j]];
}
}
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... |