답안 #726383

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
726383 2023-04-18T19:59:04 Z Toxtaq 별들과 삼각형 (IZhO11_triangle) C++17
100 / 100
773 ms 23968 KB
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    map<int, int>cntx, cnty;
    set<pair<int, int>>s;
    for(int i = 0;i < n;++i){
        int x, y;
        cin >> x >> y;
        s.insert({x, y});
        cntx[x]++;
        cnty[y]++;
    }
    long long res = 0;
    for(pair<int, int>i : s){
        int x = i.first, y = i.second;
//        cout << cntx[x] << " " << cnty[y] << '\n';
        res += (long long)(cntx[x] - 1) * (cnty[y] - 1);
    }
    cout << res;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 1 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 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 2 ms 340 KB Output is correct
11 Correct 2 ms 340 KB Output is correct
12 Correct 14 ms 1364 KB Output is correct
13 Correct 13 ms 1424 KB Output is correct
14 Correct 16 ms 1688 KB Output is correct
15 Correct 210 ms 10132 KB Output is correct
16 Correct 231 ms 10708 KB Output is correct
17 Correct 250 ms 10012 KB Output is correct
18 Correct 196 ms 10056 KB Output is correct
19 Correct 727 ms 22372 KB Output is correct
20 Correct 443 ms 17048 KB Output is correct
21 Correct 764 ms 23824 KB Output is correct
22 Correct 773 ms 23968 KB Output is correct