답안 #991320

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
991320 2024-06-02T02:29:13 Z kelfert 별들과 삼각형 (IZhO11_triangle) C++17
100 / 100
252 ms 12280 KB
#pragma GCC optimize("O3")
#pragma GCC target("avx2")
#include <bits/stdc++.h>

using namespace std;

#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
typedef long long ll;

void solve() {
    int n; cin >> n;
    vector<pair<int, int> > p(n);
    map<int, int> cntx, cnty;
    for (int i = 0; i < n; i++) {
        cin >> p[i].F >> p[i].S;
        cntx[p[i].F]++;
        cnty[p[i].S]++;
    }
    
    ll ans = 0;
    for (int i = 0; i < n; i++) ans += (cntx[p[i].F] - 1) * (cnty[p[i].S] - 1);
    cout << ans;
}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    solve();
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 604 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 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 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 5 ms 1112 KB Output is correct
13 Correct 5 ms 1116 KB Output is correct
14 Correct 7 ms 1476 KB Output is correct
15 Correct 87 ms 6228 KB Output is correct
16 Correct 95 ms 6484 KB Output is correct
17 Correct 86 ms 6228 KB Output is correct
18 Correct 84 ms 6232 KB Output is correct
19 Correct 234 ms 11604 KB Output is correct
20 Correct 191 ms 9464 KB Output is correct
21 Correct 251 ms 12280 KB Output is correct
22 Correct 252 ms 12116 KB Output is correct