답안 #975435

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
975435 2024-05-05T07:24:11 Z vjudge1 별들과 삼각형 (IZhO11_triangle) C++17
100 / 100
392 ms 15704 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long

signed main(){
    int n;
    cin >> n;
    int x[n], y[n];
    map<int, int> cntx, cnty;
    for(int i = 0; i<n; i++){
        cin >> x[i] >> y[i];
        cntx[x[i]]++;
        cnty[y[i]]++;
    }
    int ans = 0;
    for(int i = 0; i<n; i++){
        int xx = cntx[x[i]];
        int yy = cnty[y[i]];
        if(xx == 0 || yy == 0) continue;
        ans += (xx - 1)*(yy - 1);
    }
    cout << ans << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 416 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 436 KB Output is correct
11 Correct 1 ms 452 KB Output is correct
12 Correct 8 ms 1116 KB Output is correct
13 Correct 9 ms 1372 KB Output is correct
14 Correct 12 ms 1884 KB Output is correct
15 Correct 134 ms 7916 KB Output is correct
16 Correct 139 ms 8276 KB Output is correct
17 Correct 127 ms 8016 KB Output is correct
18 Correct 128 ms 8016 KB Output is correct
19 Correct 391 ms 14672 KB Output is correct
20 Correct 264 ms 11932 KB Output is correct
21 Correct 392 ms 15508 KB Output is correct
22 Correct 387 ms 15704 KB Output is correct