답안 #392881

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
392881 2021-04-22T05:57:06 Z wind_reaper 별들과 삼각형 (IZhO11_triangle) C++17
100 / 100
352 ms 12196 KB
#include <bits/stdc++.h>

using namespace std;

int32_t main(){
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL); 
		
	map<int, int> x, y;
	int n;
	cin >> n;

	vector<array<int, 2>> a(n);
	for(auto& [i, j] : a){
		cin >> i >> j;
		x[i]++;
		y[j]++;
	}

	int64_t ans = 0;

	for(int i = 0; i < n; i++)
		ans += (x[a[i][0]] - 1) * 1LL * (y[a[i][1]] - 1);

	cout << ans << '\n';
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 1 ms 320 KB Output is correct
4 Correct 1 ms 316 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 7 ms 916 KB Output is correct
13 Correct 7 ms 972 KB Output is correct
14 Correct 11 ms 1424 KB Output is correct
15 Correct 118 ms 6100 KB Output is correct
16 Correct 125 ms 6356 KB Output is correct
17 Correct 156 ms 6088 KB Output is correct
18 Correct 124 ms 6108 KB Output is correct
19 Correct 316 ms 11616 KB Output is correct
20 Correct 232 ms 9156 KB Output is correct
21 Correct 345 ms 12196 KB Output is correct
22 Correct 352 ms 12068 KB Output is correct