답안 #975577

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
975577 2024-05-05T13:39:23 Z vjudge1 별들과 삼각형 (IZhO11_triangle) C++17
100 / 100
496 ms 32016 KB
#include <bits/stdc++.h>
#define ll long long
using namespace std;

map <int, ll> X, Y;
map <ll, bool> test;
int x[300005] = {}, y[300005] = {};
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int N;
	cin >> N;
	ll ans = 0;
	for (int i = 0; i < N; i++) {
		cin >> x[i] >> y[i];
		ll t = (ll)(1e9 + 5) * (ll)(x[i]) + (ll)(y[i]);
		if (test[t])
			continue;
		X[x[i]]++; Y[y[i]]++;
		test[t] = 1;
	}
	for (int i = 0; i < N; i++)
		ans += (X[x[i]] - 1) * (Y[y[i]] - 1);
	cout << ans << '\n';
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2392 KB Output is correct
5 Correct 1 ms 2648 KB Output is correct
6 Correct 1 ms 2392 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 2 ms 2396 KB Output is correct
12 Correct 8 ms 3892 KB Output is correct
13 Correct 8 ms 3932 KB Output is correct
14 Correct 13 ms 4440 KB Output is correct
15 Correct 127 ms 14836 KB Output is correct
16 Correct 142 ms 15700 KB Output is correct
17 Correct 142 ms 14928 KB Output is correct
18 Correct 149 ms 15024 KB Output is correct
19 Correct 471 ms 30068 KB Output is correct
20 Correct 310 ms 23644 KB Output is correct
21 Correct 493 ms 31972 KB Output is correct
22 Correct 496 ms 32016 KB Output is correct