Submission #531775

#TimeUsernameProblemLanguageResultExecution timeMemory
531775makanhuliaStar triangles (IZhO11_triangle)C++17
100 / 100
578 ms6872 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; int main(){ int n; cin >> n; pair<int, int>pii[n]; map<int, ll>cntX, cntY; for(int i = 0; i < n; i++){ auto &[x, y] = pii[i]; cin >> x >> y; cntX[x]++; cntY[y]++; } ll ans = 0; for(int i = 0; i < n; i++){ auto &[x, y] = pii[i]; ans += max(0LL, (cntX[x] - 1)*(cntY[y] - 1)); } cout << ans << endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...