답안 #914038

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
914038 2024-01-20T21:14:52 Z kabgoy 별들과 삼각형 (IZhO11_triangle) C++17
100 / 100
248 ms 6032 KB
#include <bits/stdc++.h>
using namespace std;

int
main(void)
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int n;
	cin >> n;
	vector<int> x(n), y(n);
	map<int,int> cntx, cnty;
	for(int i = 0; i < n; i++){
		cin >> x[i] >> y[i];
		cntx[x[i]]++;
		cnty[y[i]]++;
	}
	long long ans = 0;
	for(int i = 0; i < n; i++)
		ans += (cntx[x[i]]-1) * (long long)(cnty[y[i]]-1);
	cout << ans << '\n';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 7 ms 860 KB Output is correct
13 Correct 5 ms 860 KB Output is correct
14 Correct 8 ms 1116 KB Output is correct
15 Correct 83 ms 4152 KB Output is correct
16 Correct 86 ms 4176 KB Output is correct
17 Correct 80 ms 4028 KB Output is correct
18 Correct 80 ms 3920 KB Output is correct
19 Correct 224 ms 5900 KB Output is correct
20 Correct 157 ms 4944 KB Output is correct
21 Correct 228 ms 5716 KB Output is correct
22 Correct 248 ms 6032 KB Output is correct