제출 #1219509

#제출 시각아이디문제언어결과실행 시간메모리
1219509giorgi123glmStar triangles (IZhO11_triangle)C++20
100 / 100
294 ms5856 KiB
#include <algorithm> #include <functional> #include <iostream> #include <list> #include <map> using namespace std; signed main () { ios::sync_with_stdio (false); cin.tie (0); cout.tie (0); int N = 0; cin >> N; vector <pair <int, int> > v (N + 1); for (int i = 1; i <= N; i++) cin >> v[i].first >> v[i].second; map <int, int> byY; map <int, int> byX; for (int i = 1; i <= N; i++) { byY[v[i].first]++; byX[v[i].second]++; } long long ans = 0; for (int i = 1; i <= N; i++) ans += 1ll * (byY[v[i].first] - 1) * (byX[v[i].second] - 1); cout << ans << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...