Submission #913459

#TimeUsernameProblemLanguageResultExecution timeMemory
913459daoquanglinh2007Star triangles (IZhO11_triangle)C++17
100 / 100
417 ms15700 KiB
#include <bits/stdc++.h> using namespace std; #define int long long const int NM = 3e5; int N, x[NM+5], y[NM+5], ans = 0; map <int, int> f, g; signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> N; for (int i = 1; i <= N; i++){ cin >> x[i] >> y[i]; f[x[i]]++; g[y[i]]++; } for (int i = 1; i <= N; i++){ ans += (f[x[i]]-1)*(g[y[i]]-1); } cout << ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...