답안 #479274

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
479274 2021-10-11T06:29:12 Z mewnian 별들과 삼각형 (IZhO11_triangle) C++14
100 / 100
1188 ms 34392 KB
#include <bits/stdc++.h>
#define sze(x) (ll)x.size()
#define idx(x, a) get<x>(a)
#define LID(x) (x << 1LL)
#define RID(x) (x << 1LL) + 1LL
#define ID(x) (x + MAXN)
#define CONV(x) (x - MAXN)
#define countbit(x) __builtin_popcountll(x)
#define pb push_back
#define x first
#define y second

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> pi;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

ll rand(ll l, ll r)
{
    return uniform_int_distribution<ll>(l, r)(rng);
}

const ll MAXN = 300'003;

ll n;
pi a[MAXN];
map< ll, ll > cx, cy;
map< pi, ll > pts;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    #ifdef OFFLINE
    freopen("input.inp", "r", stdin);
    #endif
    cin >> n;
    for (ll i = 1; i <= n; ++i)
    {
        cin >> a[i].x >> a[i].y;
        ++cx[a[i].x], ++cy[a[i].y];
        ++pts[a[i]];
    }
    ll res = 0;
    for (ll i = 1; i <= n; ++i)
    {
        res += (cx[a[i].x] - pts[a[i]]) * (cy[a[i].y] - pts[a[i]]);
    }
    cout << res;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 320 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 460 KB Output is correct
12 Correct 13 ms 1768 KB Output is correct
13 Correct 12 ms 1868 KB Output is correct
14 Correct 16 ms 2380 KB Output is correct
15 Correct 324 ms 14112 KB Output is correct
16 Correct 349 ms 15180 KB Output is correct
17 Correct 290 ms 14204 KB Output is correct
18 Correct 311 ms 14276 KB Output is correct
19 Correct 1089 ms 32080 KB Output is correct
20 Correct 768 ms 24260 KB Output is correct
21 Correct 1105 ms 34392 KB Output is correct
22 Correct 1188 ms 34348 KB Output is correct