답안 #975933

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
975933 2024-05-06T03:36:26 Z vjudge1 별들과 삼각형 (IZhO11_triangle) C++17
100 / 100
414 ms 9200 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main (){
	int n,ans = 0; cin >> n;
	map<int,int> x;
	map<int,int> y;
	pair<int,int> arr[n+1];
	for(int i =0;i<n;i++){
		int u,v; cin >> u >> v;
		x[u]++;
		y[v]++;
		arr[i] = {u,v}; //x,y
	}
	for(int i = 0;i<n;i++){
//		cout << arr[i].first << " " << x[arr[i].first] << " | " << arr[i].second << " " << y[arr[i].second] << endl;
		ans += (x[arr[i].first]-1) * (y[arr[i].second]-1);
	}
	cout << ans << endl;
	
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 512 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 600 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 2 ms 348 KB Output is correct
12 Correct 9 ms 1116 KB Output is correct
13 Correct 9 ms 1116 KB Output is correct
14 Correct 13 ms 1436 KB Output is correct
15 Correct 140 ms 5844 KB Output is correct
16 Correct 155 ms 5952 KB Output is correct
17 Correct 126 ms 5696 KB Output is correct
18 Correct 130 ms 5816 KB Output is correct
19 Correct 361 ms 8872 KB Output is correct
20 Correct 258 ms 7552 KB Output is correct
21 Correct 414 ms 9168 KB Output is correct
22 Correct 371 ms 9200 KB Output is correct