답안 #523162

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
523162 2022-02-07T07:01:37 Z Pety 별들과 삼각형 (IZhO11_triangle) C++14
100 / 100
330 ms 12252 KB
#include <bits/stdc++.h>
#define ll long long

using namespace std;

const int INF = 1e9;
const int MOD = 1e9 + 7;

map<int, int>X;
map<int, int>Y;
int x[300002], y[300002], n;

int main () 
{
  ios_base::sync_with_stdio(false);
  cin.tie(0); cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> x[i] >> y[i];
    X[x[i]]++;
    Y[y[i]]++;
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    ans += 1ll * (X[x[i]] - 1) * (Y[y[i]] - 1);
  }
  cout << ans;
  
  return 0;
}

# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 252 KB Output is correct
9 Correct 1 ms 316 KB Output is correct
10 Correct 1 ms 324 KB Output is correct
11 Correct 1 ms 324 KB Output is correct
12 Correct 6 ms 972 KB Output is correct
13 Correct 6 ms 972 KB Output is correct
14 Correct 11 ms 1380 KB Output is correct
15 Correct 109 ms 6308 KB Output is correct
16 Correct 136 ms 6476 KB Output is correct
17 Correct 117 ms 6176 KB Output is correct
18 Correct 94 ms 6188 KB Output is correct
19 Correct 276 ms 11520 KB Output is correct
20 Correct 209 ms 9156 KB Output is correct
21 Correct 294 ms 12228 KB Output is correct
22 Correct 330 ms 12252 KB Output is correct