답안 #975623

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
975623 2024-05-05T15:00:55 Z vjudge1 별들과 삼각형 (IZhO11_triangle) C++17
100 / 100
375 ms 9224 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define F first
#define S second
#define pll pair<ll, ll>
#define v(a) vector<a>

int main(){
    ll n; cin >> n;
    map<ll, ll> x, y;
    v(pll) arr(n);
    for(int i = 0; i < n; i++){
        cin >> arr[i].F >> arr[i].S;
        x[arr[i].F]++; y[arr[i].S]++;
    }

    ll ans = 0;
    for(int i = 0; i < n; i++){
        ll xx = x[arr[i].F]-1, yy = y[arr[i].S]-1;
        ans += (xx*yy);
    }

    cout << ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 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 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 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 9 ms 1116 KB Output is correct
13 Correct 9 ms 1088 KB Output is correct
14 Correct 18 ms 1628 KB Output is correct
15 Correct 129 ms 5776 KB Output is correct
16 Correct 138 ms 5916 KB Output is correct
17 Correct 134 ms 6064 KB Output is correct
18 Correct 124 ms 5844 KB Output is correct
19 Correct 337 ms 8784 KB Output is correct
20 Correct 246 ms 7652 KB Output is correct
21 Correct 375 ms 9224 KB Output is correct
22 Correct 374 ms 9040 KB Output is correct