Submission #934825

#TimeUsernameProblemLanguageResultExecution timeMemory
934825tamir1Count Squares (CEOI19_countsquares)C++17
100 / 100
1527 ms211356 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(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); 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...