답안 #887221

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
887221 2023-12-14T05:45:34 Z viwlesxq 별들과 삼각형 (IZhO11_triangle) C++17
100 / 100
240 ms 6052 KB
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define all(x) x.begin(), x.end()
#define size(x) (int)x.size()

template<class S, class T> 
bool chmin(S &a, const T &b) {
    return (a > b ? (a = b) == b : false);
}
template<class S, class T> 
bool chmax(S &a, const T &b) {
    return (a < b ? (a = b) == b : false);
}
const ll inf = 1e9;
const int mod = 1e9 + 7;

signed main() {
    cin.tie(nullptr)->sync_with_stdio(false);
    int n;
    cin >> n;
    map<int, int> mp_x, mp_y;
    ll res = 0;
    int x[n], y[n];
    for (int i = 0; i < n; ++i) {
        cin >> x[i] >> y[i];
        mp_x[x[i]]++, mp_y[y[i]]++;
    }
    for (int i = 0; i < n; ++i) {
        res += (ll)(mp_x[x[i]] - 1) * (mp_y[y[i]] - 1);
    }
    cout << res;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 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 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 5 ms 860 KB Output is correct
13 Correct 5 ms 788 KB Output is correct
14 Correct 8 ms 1116 KB Output is correct
15 Correct 79 ms 3920 KB Output is correct
16 Correct 87 ms 4180 KB Output is correct
17 Correct 81 ms 3932 KB Output is correct
18 Correct 79 ms 4092 KB Output is correct
19 Correct 238 ms 5700 KB Output is correct
20 Correct 156 ms 4944 KB Output is correct
21 Correct 235 ms 5716 KB Output is correct
22 Correct 240 ms 6052 KB Output is correct