답안 #88424

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
88424 2018-12-05T21:00:51 Z xiaowuc1 별들과 삼각형 (IZhO11_triangle) C++14
100 / 100
491 ms 34424 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int x[300000];
int y[300000];
void solve() {
  map<int, int> xs;
  map<int, int> ys;
  int n;
  cin >> n;
  for(int i = 0; i < n; i++) {
    cin >> x[i] >> y[i];
    xs[x[i]]++;
    ys[y[i]]++;
  }
  ll ret = 0;
  for(int i = 0; i < n; i++) {
    ret += (xs[x[i]] - 1LL) * (ys[y[i]] - 1LL);
  }
  cout << ret << endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 512 KB Output is correct
3 Correct 2 ms 512 KB Output is correct
4 Correct 2 ms 512 KB Output is correct
5 Correct 2 ms 520 KB Output is correct
6 Correct 3 ms 524 KB Output is correct
7 Correct 2 ms 528 KB Output is correct
8 Correct 2 ms 660 KB Output is correct
9 Correct 3 ms 660 KB Output is correct
10 Correct 3 ms 732 KB Output is correct
11 Correct 3 ms 732 KB Output is correct
12 Correct 11 ms 1304 KB Output is correct
13 Correct 10 ms 1600 KB Output is correct
14 Correct 15 ms 2076 KB Output is correct
15 Correct 181 ms 7104 KB Output is correct
16 Correct 195 ms 9708 KB Output is correct
17 Correct 167 ms 11680 KB Output is correct
18 Correct 164 ms 13772 KB Output is correct
19 Correct 491 ms 21332 KB Output is correct
20 Correct 322 ms 25136 KB Output is correct
21 Correct 481 ms 32168 KB Output is correct
22 Correct 428 ms 34424 KB Output is correct