제출 #1065592

#제출 시각아이디문제언어결과실행 시간메모리
1065592Malix별들과 삼각형 (IZhO11_triangle)C++14
100 / 100
382 ms13392 KiB
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef pair<int,int> pi;
typedef vector<pi> pii;
typedef tuple<int,int,int> tii;
typedef vector<ll> li;
typedef vector<li> lii;
 
#define REP(i,a,b) for(int i=a;i<b;i++)
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define LSOne(s) ((s)&(-s))
 
ll INF=1000000000000000010;
int inf=1e9+10;
ll M=1e9+7;

int main() {   
    int n;cin>>n;
    map<int,ll> x,y;
    vi a(n),b(n);
    REP(i,0,n)cin>>a[i]>>b[i];
    REP(i,0,n){
        x[a[i]]++;
        y[b[i]]++;
    }
    ll ans=0;
    REP(i,0,n)ans+=(x[a[i]]-1)*(y[b[i]]-1);
    cout<<ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...