답안 #336917

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
336917 2020-12-17T09:24:17 Z boykut 별들과 삼각형 (IZhO11_triangle) C++14
100 / 100
730 ms 21460 KB
#include <map>
#include <iostream>

using namespace std;

struct point {
  long double x, y;
};

map < long double, int64_t > ox;
map < long double, int64_t > oy;

//ifstream cin("triangles.in");
//ofstream cout("triangles.out");

int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  point a[n];

  for (int i = 0; i < n; i++) {
    cin >> a[i].x >> a[i].y;
    ox[a[i].x]++;
    oy[a[i].y]++;
  }

  int64_t res = 0;
  for (int i = 0; i < n; i++) {
    res += max((int64_t)(0), (int64_t)((ox[a[i].x] - 1) * (oy[a[i].y] - 1)));
  }
  cout << res << '\n';
  return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 2 ms 512 KB Output is correct
12 Correct 13 ms 1516 KB Output is correct
13 Correct 14 ms 1772 KB Output is correct
14 Correct 19 ms 2156 KB Output is correct
15 Correct 245 ms 10624 KB Output is correct
16 Correct 254 ms 11116 KB Output is correct
17 Correct 223 ms 10616 KB Output is correct
18 Correct 233 ms 10476 KB Output is correct
19 Correct 639 ms 20332 KB Output is correct
20 Correct 442 ms 15980 KB Output is correct
21 Correct 730 ms 21460 KB Output is correct
22 Correct 675 ms 21356 KB Output is correct