답안 #645588

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
645588 2022-09-27T11:33:11 Z ymm 별들과 삼각형 (IZhO11_triangle) C++17
100 / 100
307 ms 8144 KB
#include <bits/stdc++.h>
#define Loop(x,l,r) for (ll x = (l); x < (r); ++x)
#define LoopR(x,l,r) for (ll x = (r)-1; x >= (l); --x)
typedef long long ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll , ll > pll;
using namespace std;

int main()
{
	cin.tie(0) -> sync_with_stdio(false);
	int n;
	map<int, int> X, Y;
	vector<pii> a;
	cin >> n;
	while (n--) {
		int x, y;
		cin >> x >> y;
		X[x]++;
		Y[y]++;
		a.push_back({x, y});
	}
	ll ans = 0;
	for (auto [x, y] : a)
		ans += (ll)(X[x]-1) * (Y[y]-1);
	cout << ans << '\n';
}

# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 0 ms 316 KB Output is correct
9 Correct 1 ms 320 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 6 ms 988 KB Output is correct
13 Correct 7 ms 1016 KB Output is correct
14 Correct 9 ms 1364 KB Output is correct
15 Correct 103 ms 4648 KB Output is correct
16 Correct 99 ms 4744 KB Output is correct
17 Correct 98 ms 4660 KB Output is correct
18 Correct 99 ms 4620 KB Output is correct
19 Correct 255 ms 8112 KB Output is correct
20 Correct 199 ms 5856 KB Output is correct
21 Correct 269 ms 8084 KB Output is correct
22 Correct 307 ms 8144 KB Output is correct