제출 #1325593

#제출 시각아이디문제언어결과실행 시간메모리
1325593vtnooStar triangles (IZhO11_triangle)C++20
100 / 100
105 ms12564 KiB
#include <bits/stdc++.h>
#define L(i, j, k) for(int i = (j); i <= (k); i++)
#define R(i, j, k) for(int i = (j); i >= (k); i--)
#define all(x) x.begin(), x.end()
#define sz(a) ((int) a.size())
#define pb emplace_back
#define fst first
#define snd second
using namespace std;
typedef long long ll;
const int INF=1e9,MAXN=1e5+5;
void chmin(int &a,int b){a=min(a,b);}
struct Point{
	int x,y;
};
unordered_map<int,vector<int>>px,py;
int main(){
	ios::sync_with_stdio(false); 
	cin.tie(nullptr);
	int n;cin>>n;
	vector<Point>p(n);
	L(i,0,n-1){
		int a,b;cin>>a>>b;
		p[i]={a,b};
		px[a].pb(i);
		py[b].pb(i);
	}
	ll ans=0;
	L(i,0,n-1){
		int a=sz(px[p[i].x])-1,b=sz(py[p[i].y])-1;
		ans+=a*b;
	}
	cout<<ans<<endl;
}

#Verdict Execution timeMemoryGrader output
Fetching results...