Submission #934824

#TimeUsernameProblemLanguageResultExecution timeMemory
934824tamir1Count Squares (CEOI19_countsquares)C++17
100 / 100
1548 ms211556 KiB
#include<bits/stdc++.h> #define ll long long using namespace std; ll i,j,h,v,x[2000],y[2000],ans; map<ll,ll> mp1,mp2; int main(){ cin >> h >> v; for(i=1;i<=h;i++){ cin >> y[i]; } for(i=1;i<=v;i++){ cin >> x[i]; } for(i=1;i<=h;i++){ for(j=i+1;j<=h;j++) mp1[y[j]-y[i]]++; } for(i=1;i<=v;i++){ for(j=i+1;j<=v;j++) mp2[x[j]-x[i]]++; } for(auto [a,b]:mp1){ ans+=(b*mp2[a]); } cout << ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...