답안 #87942

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
87942 2018-12-03T09:25:25 Z turbat 별들과 삼각형 (IZhO11_triangle) C++14
100 / 100
870 ms 38880 KB
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
int n;
long long ans;
pair <int, int> p[300005];
map <int, int> my, mx;

int main (){
	//freopen ("input.in", "r", stdin);
	//freopen ("output.out", "w", stdout);	
	cin >> n;
	for (int i = 0;i < n;i++){
		cin >> p[i].F>> p[i].S;
		mx[p[i].F]++;
		my[p[i].S]++;
	}
	for (int i = 0;i < n;i++)
		ans += (mx[p[i].F] - 1) * (my[p[i].S] - 1);
	cout << ans<<endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 472 KB Output is correct
3 Correct 2 ms 472 KB Output is correct
4 Correct 2 ms 472 KB Output is correct
5 Correct 3 ms 544 KB Output is correct
6 Correct 2 ms 656 KB Output is correct
7 Correct 2 ms 660 KB Output is correct
8 Correct 3 ms 776 KB Output is correct
9 Correct 3 ms 776 KB Output is correct
10 Correct 3 ms 776 KB Output is correct
11 Correct 3 ms 776 KB Output is correct
12 Correct 16 ms 1396 KB Output is correct
13 Correct 17 ms 1612 KB Output is correct
14 Correct 23 ms 2224 KB Output is correct
15 Correct 242 ms 7292 KB Output is correct
16 Correct 305 ms 9868 KB Output is correct
17 Correct 278 ms 11628 KB Output is correct
18 Correct 256 ms 13868 KB Output is correct
19 Correct 736 ms 21432 KB Output is correct
20 Correct 520 ms 25200 KB Output is correct
21 Correct 785 ms 32428 KB Output is correct
22 Correct 870 ms 38880 KB Output is correct