Submission #267303

#TimeUsernameProblemLanguageResultExecution timeMemory
267303taulantCount Squares (CEOI19_countsquares)C++14
100 / 100
2107 ms158788 KiB
#include<bits/stdc++.h> using namespace std; int main(){ cin.tie(0)->sync_with_stdio(0); int h, v; cin >> h >> v; map<int, int> m, n; vector<int> a(h), b(v); for(int& i:a) cin >> i; for(int& i:b) cin >> i; for(int i=0; i<h; ++i) for(int j=i+1; j<h; ++j) ++m[a[j]-a[i]]; for(int i=0; i<v; ++i) for(int j=i+1; j<v; ++j) ++n[b[j]-b[i]]; int ans = 0; for(auto& i:m) ans += i.second * n[i.first]; cout << ans << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...