답안 #41333

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
41333 2018-02-16T13:22:52 Z IvanC 별들과 삼각형 (IZhO11_triangle) C++14
100 / 100
521 ms 42360 KB
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3*1e5 + 10;
typedef long long ll;
ll N,ans,c1[MAXN],c2[MAXN];
map<ll,ll> X,Y;
int main(){
	cin.tie(0);ios_base::sync_with_stdio(0);
	cin >> N;
	for(int i = 1;i<=N;i++){
		cin >> c1[i] >> c2[i];
		X[c1[i]]++;
		Y[c2[i]]++;
	}
	for(int i = 1;i<=N;i++){
		ans += (X[c1[i]] - 1)*(Y[c2[i]] - 1);
	}
	cout << ans << endl;
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 248 KB Output is correct
2 Correct 1 ms 356 KB Output is correct
3 Correct 1 ms 464 KB Output is correct
4 Correct 2 ms 488 KB Output is correct
5 Correct 2 ms 768 KB Output is correct
6 Correct 1 ms 772 KB Output is correct
7 Correct 1 ms 772 KB Output is correct
8 Correct 2 ms 776 KB Output is correct
9 Correct 2 ms 776 KB Output is correct
10 Correct 2 ms 884 KB Output is correct
11 Correct 2 ms 892 KB Output is correct
12 Correct 9 ms 1696 KB Output is correct
13 Correct 8 ms 1988 KB Output is correct
14 Correct 14 ms 2584 KB Output is correct
15 Correct 170 ms 8944 KB Output is correct
16 Correct 207 ms 11668 KB Output is correct
17 Correct 203 ms 13572 KB Output is correct
18 Correct 188 ms 15696 KB Output is correct
19 Correct 469 ms 24692 KB Output is correct
20 Correct 347 ms 27876 KB Output is correct
21 Correct 507 ms 35888 KB Output is correct
22 Correct 521 ms 42360 KB Output is correct