답안 #532930

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
532930 2022-03-04T08:50:21 Z christinelynn 별들과 삼각형 (IZhO11_triangle) C++17
100 / 100
518 ms 12140 KB
#include <bits/stdc++.h>
using namespace std;

int main() {
  int n;
  cin >> n;

  map<int, int> mpx;
  map<int, int> mpy;

  pair<int, int> coor[n+5];

  for(int i = 1; i<=n; i++) {
    int a, b;
    cin >> a >> b;
    coor[i] = {a, b};
    mpx[a]++;
    mpy[b]++;
  }

  long long total1 = 0;

  for(int i = 1; i<=n; i++) {
    total1 += 1ll*(mpx[coor[i].first]-1)*(mpy[coor[i].second]-1);
  }

  cout << total1 << endl;

  
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 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 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 2 ms 332 KB Output is correct
11 Correct 2 ms 336 KB Output is correct
12 Correct 11 ms 980 KB Output is correct
13 Correct 17 ms 1008 KB Output is correct
14 Correct 17 ms 1356 KB Output is correct
15 Correct 193 ms 6052 KB Output is correct
16 Correct 194 ms 6328 KB Output is correct
17 Correct 182 ms 6196 KB Output is correct
18 Correct 191 ms 6132 KB Output is correct
19 Correct 447 ms 11504 KB Output is correct
20 Correct 387 ms 9100 KB Output is correct
21 Correct 518 ms 12056 KB Output is correct
22 Correct 517 ms 12140 KB Output is correct