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
#define ff first
#define ss second
#define pb push_back
const int N=3e5+5;
int ans=0;
int x[N],y[N];
map<int,int>px,py;
signed main(){
int n,m;
cin>>n>>m;
for(int i=1;i<=n;i++){
cin>>x[i];
}
for(int i=1;i<=m;i++){
cin>>y[i];
}
for(int i=1;i<=n;i++){
for(int j=i+1;j<=n;j++){
px[x[j]-x[i]]++;
}
}
int ans=0;
for(int i=1;i<=m;i++){
for(int j=i+1;j<=m;j++){
ans+=px[y[j]-y[i]];
}
}
cout<<ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |