제출 #1326665

#제출 시각아이디문제언어결과실행 시간메모리
1326665kawhiet별들과 삼각형 (IZhO11_triangle)C++20
100 / 100
291 ms5848 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    vector<int> x(n), y(n);
    map<int, int> a, b;
    for (int i = 0; i < n; i++) {
        cin >> x[i] >> y[i];
        a[x[i]]++; b[y[i]]++;
    }
    long long ans = 0;
    for (int i = 0; i < n; i++) {
        ans += 1LL * (a[x[i]] - 1) * (b[y[i]] - 1);
    }
    cout << ans << '\n';
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...