답안 #523928

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
523928 2022-02-08T12:20:39 Z Bill_00 별들과 삼각형 (IZhO11_triangle) C++14
100 / 100
147 ms 11836 KB
#include <bits/stdc++.h>
#define MOD 1000000007
typedef long long ll;
using namespace std;
 
int x[1000000], y[1000000];
unordered_map<int, ll> um[2];
 
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	int n;
	cin >> n;
	for(int i = 1; i <= n; i++){
		cin >> x[i] >> y[i];
		um[0][x[i]]++;
		um[1][y[i]]++;
	}
	ll ans = 0;
	for(int i = 1; i <= n; i++){
		ans += ((um[0][x[i]] - 1) * (um[1][y[i]] - 1));
	}
	cout << ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 2 ms 204 KB Output is correct
7 Correct 0 ms 332 KB Output is correct
8 Correct 1 ms 332 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 4 ms 716 KB Output is correct
13 Correct 4 ms 716 KB Output is correct
14 Correct 6 ms 1100 KB Output is correct
15 Correct 43 ms 3684 KB Output is correct
16 Correct 40 ms 3824 KB Output is correct
17 Correct 39 ms 3672 KB Output is correct
18 Correct 39 ms 5804 KB Output is correct
19 Correct 130 ms 11184 KB Output is correct
20 Correct 138 ms 8828 KB Output is correct
21 Correct 147 ms 11836 KB Output is correct
22 Correct 142 ms 11772 KB Output is correct