Submission #1111828

#TimeUsernameProblemLanguageResultExecution timeMemory
1111828ezzzayCount Squares (CEOI19_countsquares)C++14
100 / 100
1861 ms143128 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...