답안 #406313

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
406313 2021-05-17T11:02:04 Z saarang123 별들과 삼각형 (IZhO11_triangle) C++17
100 / 100
358 ms 12136 KB
#include <bits/stdc++.h>
using namespace std;
 
signed 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]++;
	}
 
	long long 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 388 KB Output is correct
3 Correct 1 ms 204 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 320 KB Output is correct
7 Correct 1 ms 332 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 328 KB Output is correct
12 Correct 8 ms 972 KB Output is correct
13 Correct 7 ms 1052 KB Output is correct
14 Correct 11 ms 1348 KB Output is correct
15 Correct 120 ms 6084 KB Output is correct
16 Correct 164 ms 6424 KB Output is correct
17 Correct 114 ms 6116 KB Output is correct
18 Correct 122 ms 6116 KB Output is correct
19 Correct 332 ms 11496 KB Output is correct
20 Correct 228 ms 9184 KB Output is correct
21 Correct 358 ms 12108 KB Output is correct
22 Correct 337 ms 12136 KB Output is correct