Submission #605751

#TimeUsernameProblemLanguageResultExecution timeMemory
605751ukraineCount Squares (CEOI19_countsquares)C++17
7 / 100
4088 ms17152 KiB
#include<bits/stdc++.h> #define ll long long #define pb push_back using namespace std; ll h, v, x[10005], y[10005], ans = 0; set <ll> sx, sy; int main() { cin >> h >> v; for(int i = 1; i <= h; i++) { cin >> y[i]; } for(int i = 1; i <= v; i++) { cin >> x[i]; } for(int i = 1; i < h; i++) { for(int j = i + 1; j <= h; j++) { sy.insert(y[j] - y[i]); } } for(int i = 1; i < v; i++) { for(int j = i + 1; j <= v; j++) { sx.insert(x[j] - x[i]); } } for(auto u: sx) { for(auto v: sy) { if(u == v) ans++; } } cout << ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...