Submission #260371

#TimeUsernameProblemLanguageResultExecution timeMemory
260371stefantagaCount Squares (CEOI19_countsquares)C++11
100 / 100
2240 ms106036 KiB
#include <bits/stdc++.h> using namespace std; int inalt[1505],oriz[1505]; int i,j,n,m1,val; map <int,int> m2; long long p; int main() { ios_base :: sync_with_stdio(false); cin.tie(0); cin>>n>>m1; for (i=1;i<=n;i++) { cin>>inalt[i]; } for (j=1;j<=m1;j++) { cin>>oriz[j]; } for (i=1;i<=m1;i++) { for (j=i+1;j<=m1;j++) { m2[oriz[j]-oriz[i]]++; } } p=0; for (i=1;i<=n;i++) { for (j=i+1;j<=n;j++) { val=inalt[j]-inalt[i]; p=p+m2[val]; } } cout<<p; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...