답안 #975209

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
975209 2024-05-04T14:52:01 Z vjudge1 별들과 삼각형 (IZhO11_triangle) C++17
100 / 100
275 ms 12832 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long

const int N = 3e5 + 5;

map < ll, ll > mpx, mpy;

vector < pair < ll, ll >> a ( N );

ll n;

signed main(){
    ios_base::sync_with_stdio(0); cin.tie(0);

    cin >> n;

    for ( int i = 1; i <= n; i++){
        cin >> a[i].first >> a[i].second;
        mpx[a[i].first]++;
        mpy[a[i].second]++;
    }

    ll ans = 0;

    for ( int i = 1; i <= n; i++){
        ans += ( 1ll * ( mpx[a[i].first] - 1 ) * ( mpy[a[i].second] - 1) );
    }

    cout << ans << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 4956 KB Output is correct
2 Correct 1 ms 4956 KB Output is correct
3 Correct 1 ms 4956 KB Output is correct
4 Correct 2 ms 4956 KB Output is correct
5 Correct 2 ms 4956 KB Output is correct
6 Correct 1 ms 4956 KB Output is correct
7 Correct 1 ms 4956 KB Output is correct
8 Correct 3 ms 4956 KB Output is correct
9 Correct 2 ms 4956 KB Output is correct
10 Correct 3 ms 5208 KB Output is correct
11 Correct 2 ms 5208 KB Output is correct
12 Correct 9 ms 5724 KB Output is correct
13 Correct 7 ms 5936 KB Output is correct
14 Correct 10 ms 6236 KB Output is correct
15 Correct 91 ms 10276 KB Output is correct
16 Correct 104 ms 10688 KB Output is correct
17 Correct 86 ms 10320 KB Output is correct
18 Correct 86 ms 10172 KB Output is correct
19 Correct 236 ms 12644 KB Output is correct
20 Correct 177 ms 11600 KB Output is correct
21 Correct 260 ms 12660 KB Output is correct
22 Correct 275 ms 12832 KB Output is correct