제출 #601104

#제출 시각아이디문제언어결과실행 시간메모리
601104kabika별들과 삼각형 (IZhO11_triangle)C++14
100 / 100
501 ms20292 KiB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define x first
#define y second

int main() 
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin >> n;
	map<int,vector<int>> xfx, yfx;
	vector<pair<int,int>> st(n);
	for(int i = 0; i < n; ++i)
	{
	    cin >> st[i].x >> st[i].y;
	    xfx[st[i].x].push_back(st[i].y);
	    yfx[st[i].y].push_back(st[i].x);
	}
	
	ll ans = 0;
	for(int i = 0; i < n; ++i)
	{
	    ll t = (xfx[st[i].x].size() - 1)*(yfx[st[i].y].size() - 1);
	    //cout << t << '\n';
	    ans += t;
	}
	cout << ans << '\n';
	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...