Submission #1130589

#TimeUsernameProblemLanguageResultExecution timeMemory
1130589lopkus별들과 삼각형 (IZhO11_triangle)C++20
100 / 100
296 ms9020 KiB
#include <bits/stdc++.h>

#define int long long

using namespace std;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    vector<int> x(n + 1);
    vector<int> y(n + 1);
    for(int i = 1; i <= n; i++) {
        cin >> x[i] >> y[i];
    }
    map<int,int> cntx;
    map<int,int> cnty;
    for(int i = 1; i <= n; i++) {
        cntx[x[i]] += 1;
        cnty[y[i]] += 1;
    }
    int ans = 0;
    for(int i = 1; i <= n; i++) {
        ans += (cntx[x[i]] - 1) * (cnty[y[i]] - 1);
    }
    cout << ans;
}

#Verdict Execution timeMemoryGrader output
Fetching results...