답안 #17447

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
17447 2015-12-12T12:42:30 Z gs14004 별들과 삼각형 (IZhO11_triangle) C++14
100 / 100
456 ms 7100 KB
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <string>
#include <functional>
#include <vector>
#include <numeric>
#include <deque>
#include <utility>
#include <bitset>
#include <iostream>
using namespace std;
typedef long long lint;
typedef long double llf;
typedef pair<int, int> pi;

map<int, int> mx, my;
int n;
pi a[300005];

int main(){
	scanf("%d",&n);
	for(int i=0; i<n; i++){
		scanf("%d %d",&a[i].first, &a[i].second);
		mx[a[i].first]++;
		my[a[i].second]++;
	}
	lint ret = 0;
	for(int i=0; i<n; i++){
		ret += 1ll * (mx[a[i].first]-1) * (my[a[i].second]-1);
	}
	cout << ret;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 4064 KB Output is correct
2 Correct 0 ms 4064 KB Output is correct
3 Correct 1 ms 4064 KB Output is correct
4 Correct 0 ms 4064 KB Output is correct
5 Correct 0 ms 4064 KB Output is correct
6 Correct 0 ms 4064 KB Output is correct
7 Correct 2 ms 4064 KB Output is correct
8 Correct 0 ms 4064 KB Output is correct
9 Correct 0 ms 4064 KB Output is correct
10 Correct 0 ms 4064 KB Output is correct
11 Correct 3 ms 4064 KB Output is correct
12 Correct 6 ms 4460 KB Output is correct
13 Correct 0 ms 4460 KB Output is correct
14 Correct 8 ms 4856 KB Output is correct
15 Correct 177 ms 6968 KB Output is correct
16 Correct 148 ms 6968 KB Output is correct
17 Correct 151 ms 6968 KB Output is correct
18 Correct 150 ms 6968 KB Output is correct
19 Correct 422 ms 7100 KB Output is correct
20 Correct 298 ms 7100 KB Output is correct
21 Correct 456 ms 7100 KB Output is correct
22 Correct 456 ms 7100 KB Output is correct