Submission #934823

#TimeUsernameProblemLanguageResultExecution timeMemory
934823tamir1Count Squares (CEOI19_countsquares)C++14
100 / 100
1466 ms211476 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; }

Compilation message (stderr)

countsquares.cpp: In function 'int main()':
countsquares.cpp:22:11: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   22 |  for(auto [a,b]:mp1){
      |           ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...