답안 #334593

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
334593 2020-12-09T14:30:24 Z sahil_k 별들과 삼각형 (IZhO11_triangle) C++14
100 / 100
534 ms 12396 KB
#include <iostream>
#include <map>
using namespace std;
int main () {
	int n;
	cin >> n;
	pair<int, int> pos[n];
	for (int i=0; i<n; i++) {
		cin >> pos[i].first >> pos[i].second;
	}
	map<int, int> rows;
	for (int i=0; i<n; i++) {
		rows[pos[i].first]++;
	}
	map<int, int> cols;
	for (int i=0; i<n; i++) {
		cols[pos[i].second]++;
	}
	long long o = 0;
	for (int i=0; i<n; i++) {
		o += 1ll*(rows[pos[i].first]-1)*(cols[pos[i].second]-1);
	}
	cout << o << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 2 ms 364 KB Output is correct
12 Correct 12 ms 1004 KB Output is correct
13 Correct 13 ms 1004 KB Output is correct
14 Correct 17 ms 1388 KB Output is correct
15 Correct 182 ms 6124 KB Output is correct
16 Correct 197 ms 6508 KB Output is correct
17 Correct 179 ms 6124 KB Output is correct
18 Correct 179 ms 6124 KB Output is correct
19 Correct 492 ms 11500 KB Output is correct
20 Correct 358 ms 9204 KB Output is correct
21 Correct 534 ms 12396 KB Output is correct
22 Correct 528 ms 12140 KB Output is correct