Submission #1119508

#TimeUsernameProblemLanguageResultExecution timeMemory
1119508vjudge1Count Squares (CEOI19_countsquares)C++17
100 / 100
2035 ms105824 KiB
#include <bits/stdc++.h> #define pb push_back #define sz(x) (int)x.size() #define all(x) x.begin(), x.end() #define f first #define s second using namespace std; using ll = long long; using pii = pair <int, int>; const int N = 2e3 + 5; int h, v, x[N], y[N]; int main() { ios :: sync_with_stdio(0); cin.tie(0); cin >> h >> v; map <int, int> cnt; for (int i = 1; i <= h; ++i) { cin >> x[i]; for (int j = i - 1; j > 0; j--) { cnt[x[i] - x[j]]++; } } int ans = 0; for (int i = 1; i <= v; ++i) { cin >> y[i]; for (int j = i - 1; j > 0; j--) { ans += cnt[y[i] - y[j]]; } } cout << ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...