답안 #687487

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
687487 2023-01-26T12:47:14 Z speedyArda 별들과 삼각형 (IZhO11_triangle) C++14
100 / 100
486 ms 13224 KB
#include "bits/stdc++.h"

using namespace std;
map<int, long long> x_cnt;
map<int, long long> y_cnt;
int main() 
{
    int n;
    cin >> n;

    pair<int, int> coords[n+5];
    for(int i = 0; i < n; i++) {
        cin >> coords[i].first >> coords[i].second;
        x_cnt[coords[i].first]++;
        y_cnt[coords[i].second]++;
    }
    sort(coords, coords + n);
    long long ans = 0;

    for(int i = 0; i < n; i++)
    {
        ans += (x_cnt[coords[i].first] - 1) * (y_cnt[coords[i].second] - 1);
    }

    cout << ans << "\n";

    
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 304 KB Output is correct
8 Correct 1 ms 304 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 2 ms 340 KB Output is correct
12 Correct 12 ms 1076 KB Output is correct
13 Correct 12 ms 1208 KB Output is correct
14 Correct 19 ms 1588 KB Output is correct
15 Correct 162 ms 7100 KB Output is correct
16 Correct 192 ms 7520 KB Output is correct
17 Correct 170 ms 7180 KB Output is correct
18 Correct 181 ms 7116 KB Output is correct
19 Correct 432 ms 12516 KB Output is correct
20 Correct 316 ms 10260 KB Output is correct
21 Correct 486 ms 13176 KB Output is correct
22 Correct 466 ms 13224 KB Output is correct