답안 #787479

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
787479 2023-07-19T08:25:40 Z anton 별들과 삼각형 (IZhO11_triangle) C++17
100 / 100
400 ms 15552 KB
#include<bits/stdc++.h>

using namespace std;
#define int long long

const int MAX_N = 3*1e6;
int n, pos[MAX_N][2];
map<int, int> x;
map<int, int> y;

signed main(){
    cin>>n;

    for(int i = 0; i<n; i++){
        cin>>pos[i][0]>>pos[i][1];
        x[pos[i][0]]++;
        y[pos[i][1]]++;
    }

    int res=  0;

    for(int i = 0; i<n; i++){
        res+=(x[pos[i][0]]-1LL)*(y[pos[i][1]]-1);
    }

    cout<<res<<endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 304 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 312 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 312 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 324 KB Output is correct
12 Correct 8 ms 1116 KB Output is correct
13 Correct 9 ms 1236 KB Output is correct
14 Correct 14 ms 1748 KB Output is correct
15 Correct 127 ms 7892 KB Output is correct
16 Correct 163 ms 8256 KB Output is correct
17 Correct 127 ms 7808 KB Output is correct
18 Correct 128 ms 7840 KB Output is correct
19 Correct 348 ms 14720 KB Output is correct
20 Correct 265 ms 11740 KB Output is correct
21 Correct 375 ms 15548 KB Output is correct
22 Correct 400 ms 15552 KB Output is correct