답안 #975001

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
975001 2024-05-04T09:28:34 Z vjudge1 별들과 삼각형 (IZhO11_triangle) C++17
100 / 100
83 ms 5484 KB
#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define ll long long
#define rep(i, n) for(int i = 0 ; i < n ; i++)
#define all(a) a.begin(), a.end()

unordered_map<int, int> X;
unordered_map<int, int> Y;

int main() {
    fast

    int n; cin>>n;
    pair<int, int> coor[n+1];
    rep(i, n){
        int x, y; cin>>x>>y;
        X[x]++;
        Y[y]++;
        coor[i+1].first = x;
        coor[i+1].second = y;
    }
    ll ans = 0;
    for(int i = 1 ; i <= n ; i++){
        int x = coor[i].first;
        int y = coor[i].second;
        ans += (X[x] - 1)*(Y[y] - 1);
    }
    cout<<ans;
    
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 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 600 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 4 ms 860 KB Output is correct
13 Correct 3 ms 860 KB Output is correct
14 Correct 5 ms 1116 KB Output is correct
15 Correct 30 ms 3860 KB Output is correct
16 Correct 32 ms 3924 KB Output is correct
17 Correct 32 ms 3848 KB Output is correct
18 Correct 29 ms 3860 KB Output is correct
19 Correct 75 ms 5204 KB Output is correct
20 Correct 54 ms 4548 KB Output is correct
21 Correct 83 ms 5368 KB Output is correct
22 Correct 81 ms 5484 KB Output is correct