Submission #267194

#TimeUsernameProblemLanguageResultExecution timeMemory
267194taulantCount Squares (CEOI19_countsquares)C++17
100 / 100
2356 ms211384 KiB
#include<bits/stdc++.h> using namespace std; #define int long long int32_t main(){ int h, v; cin >> h >> v; map<int, int> m1, m2; vector<int> v1(h), v2(v); for(int& i:v1) cin >> i; for(int& i:v2) cin >> i; for(int i=0; i<h; ++i){ for(int j=i+1; j<h; ++j) ++m1[v1[j]-v1[i]]; } for(int i=0; i<v; ++i){ for(int j=i+1; j<v; ++j) ++m2[v2[j]-v2[i]]; } int ans = 0; for(auto i:m1) ans += i.second * m2[i.first]; cout << ans << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...