답안 #142549

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
142549 2019-08-09T14:02:25 Z vardan__02 별들과 삼각형 (IZhO11_triangle) C++14
100 / 100
188 ms 14524 KB
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <deque>
#include <cstring>
#include <string>
#include <unordered_map>
#define ll long long
#define ld long double
using namespace std;
unordered_map<ll,ll> x,y;
ll i, j, n, m, k, p, q, a[300005], b[300005];
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin >> n;
	for (i = 1; i <= n; i++)
	{
		cin >> a[i] >> b[i];
		x[a[i]]++;
		y[b[i]]++;
	}
	for (i = 1; i <= n; i++)
		m += (x[a[i]] - 1)*(y[b[i]] - 1);
	cout << m << endl;
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 536 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 428 KB Output is correct
10 Correct 2 ms 348 KB Output is correct
11 Correct 3 ms 380 KB Output is correct
12 Correct 8 ms 1144 KB Output is correct
13 Correct 8 ms 1144 KB Output is correct
14 Correct 10 ms 1400 KB Output is correct
15 Correct 69 ms 6872 KB Output is correct
16 Correct 72 ms 7256 KB Output is correct
17 Correct 70 ms 6840 KB Output is correct
18 Correct 70 ms 6844 KB Output is correct
19 Correct 172 ms 13500 KB Output is correct
20 Correct 129 ms 10712 KB Output is correct
21 Correct 188 ms 14524 KB Output is correct
22 Correct 186 ms 14432 KB Output is correct