제출 #977008

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

#define ll long long
#define fs first
#define sc second

int main(){
    int n;
    cin>>n;
    multiset<pair<int,int>> p;
    multiset<int> mx,my;
    while (n--) {
        int x,y;
        cin>>x>>y;
        p.insert({x,y});
        mx.insert(x);my.insert(y);
    }
    ll cnt=0;
    for (auto [x,y]:p){
        ll a=mx.count(x)-p.count({x,y}),b=my.count(y)-p.count({x,y});
        cnt+=a*b;
    }
    cout<<cnt;
}   
#Verdict Execution timeMemoryGrader output
Fetching results...