답안 #17676

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
17676 2016-01-12T06:44:29 Z Adilkhan 별들과 삼각형 (IZhO11_triangle) C++
100 / 100
532 ms 13624 KB
#include <bits/stdc++.h>

#define pb push_back
#define endl "\n"
#define mp make_pair 
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define fname ""
#define sz(x) (int)(x.size())

typedef long long ll;

using namespace std;

const ll N = (ll)(5e5) + 322;
const ll INF = (ll)(1e9);
const ll mod = (ll)(1e9) + 7;
const double eps = 1e-9;

ll n, x[N], y[N], ans;

map <ll, ll> X, Y;

int main () {
	ios_base :: sync_with_stdio (false); cin.tie(0);
//	freopen(fname".in", "r", stdin);
	//freopen(fname".out", "w", stdout);
	cin >> n;
	for (int i = 1; i <= n; ++i) {
		cin >> x[i] >> y[i];
		X[x[i]]++;
		Y[y[i]]++;
	}
	for (int i = 1; i <= n; ++i) {
		ans += (X[x[i]] - 1) * (Y[y[i]] - 1);
	}
	cout << ans;
	return 0;
}

# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 9532 KB Output is correct
2 Correct 0 ms 9532 KB Output is correct
3 Correct 0 ms 9532 KB Output is correct
4 Correct 0 ms 9532 KB Output is correct
5 Correct 0 ms 9532 KB Output is correct
6 Correct 0 ms 9532 KB Output is correct
7 Correct 0 ms 9664 KB Output is correct
8 Correct 0 ms 9664 KB Output is correct
9 Correct 0 ms 9664 KB Output is correct
10 Correct 0 ms 9664 KB Output is correct
11 Correct 0 ms 9664 KB Output is correct
12 Correct 7 ms 10192 KB Output is correct
13 Correct 8 ms 10192 KB Output is correct
14 Correct 14 ms 10720 KB Output is correct
15 Correct 161 ms 13492 KB Output is correct
16 Correct 181 ms 13492 KB Output is correct
17 Correct 179 ms 13492 KB Output is correct
18 Correct 169 ms 13492 KB Output is correct
19 Correct 469 ms 13624 KB Output is correct
20 Correct 347 ms 13624 KB Output is correct
21 Correct 492 ms 13624 KB Output is correct
22 Correct 532 ms 13624 KB Output is correct