답안 #1005377

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1005377 2024-06-22T11:36:10 Z andrewp 별들과 삼각형 (IZhO11_triangle) C++14
100 / 100
364 ms 24648 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ar array

const int mxN=3e5+1;
int n;
ar<int, 2> a[mxN];

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);

    cin >> n;
    map<int, int> x, y;
    map<ar<int, 2>, int> cnt;
    for(int i=1; i<=n; ++i) {
        cin >> a[i][0] >> a[i][1];
        x[a[i][0]]++;
        y[a[i][1]]++;
        cnt[{a[i][0], a[i][1]}]++;
    }
    ll ans=0;
    for(auto it:cnt) {
        int X=it.first[0], Y=it.first[1];
        ans+=(x[X]-cnt[{X, Y}])*(y[Y]-cnt[{X, Y}]);
    }
    cout << ans << "\n";
}

# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 8 ms 1604 KB Output is correct
13 Correct 6 ms 1628 KB Output is correct
14 Correct 10 ms 1884 KB Output is correct
15 Correct 117 ms 11628 KB Output is correct
16 Correct 132 ms 12564 KB Output is correct
17 Correct 110 ms 11856 KB Output is correct
18 Correct 113 ms 11636 KB Output is correct
19 Correct 357 ms 23376 KB Output is correct
20 Correct 239 ms 18136 KB Output is correct
21 Correct 360 ms 24568 KB Output is correct
22 Correct 364 ms 24648 KB Output is correct