Submission #726383

#TimeUsernameProblemLanguageResultExecution timeMemory
726383Toxtaq별들과 삼각형 (IZhO11_triangle)C++17
100 / 100
773 ms23968 KiB
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    map<int, int>cntx, cnty;
    set<pair<int, int>>s;
    for(int i = 0;i < n;++i){
        int x, y;
        cin >> x >> y;
        s.insert({x, y});
        cntx[x]++;
        cnty[y]++;
    }
    long long res = 0;
    for(pair<int, int>i : s){
        int x = i.first, y = i.second;
//        cout << cntx[x] << " " << cnty[y] << '\n';
        res += (long long)(cntx[x] - 1) * (cnty[y] - 1);
    }
    cout << res;
}
#Verdict Execution timeMemoryGrader output
Fetching results...