답안 #17679

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
17679 2016-01-12T06:53:06 Z chrome 별들과 삼각형 (IZhO11_triangle) C++
100 / 100
498 ms 162072 KB
#include <bits/stdc++.h>

using namespace std;

/* My code is cute, isn't it? :3 */

#define ll long long
#define foreach(it, S) for(__typeof (S.begin()) it = S.begin(); it != S.end(); it++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define MN(a, b) a = min (a, b)
#define MX(a, b) a = max (a, b)
#define endl '\n'

#define fname "triangles"

#define read(type, args...) type args; rdr,args;

#define nxtnt getNext <int>()
#define nxtll getNext <ll>()

template <typename T> inline T getNext () { T s = 1, x = 0, c = getc(stdin); while (c <= 32) c = getc(stdin); if (c == '-') s = -1, c = getc(stdin); while ('0' <= c && c <= '9') x = x * 10 + c - '0', c = getc(stdin); return x * s; }

struct reader { template<typename T> reader& operator, (T &v) { v = getNext <T>(); return *this;} } rdr;

const double eps = 1e-9;

bool Equals (double x, double y) { return abs (x - y) < eps; }
bool Less (double x, double y) { return (x) < y - eps; }
bool LessOrEqual (double x, double y) { return (x) < y + eps; }

const int MaxN = int (1e7) + 256;

ll x[MaxN], y[MaxN];

int main () {
    // freopen (fname".in", "r", stdin);
    // freopen (fname".out", "w", stdout);
    
    map <ll, ll> m, q;
    
    ll n = nxtnt;
    
    for (int i = 0; i < n; ++i) {
        x[i] = nxtnt, y[i] = nxtnt;
        m[x[i]]++;
        q[y[i]]++;
    }
    
    ll res = 0;
    
    for (int i = 0; i < n; ++i) {
        res += ((m[x[i]] - 1) * (q[y[i]] - 1));
    }
    
    cout << res;
    
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 157980 KB Output is correct
2 Correct 0 ms 157980 KB Output is correct
3 Correct 0 ms 157980 KB Output is correct
4 Correct 0 ms 157980 KB Output is correct
5 Correct 0 ms 157980 KB Output is correct
6 Correct 0 ms 157980 KB Output is correct
7 Correct 0 ms 157980 KB Output is correct
8 Correct 0 ms 157980 KB Output is correct
9 Correct 0 ms 157980 KB Output is correct
10 Correct 0 ms 157980 KB Output is correct
11 Correct 0 ms 157980 KB Output is correct
12 Correct 7 ms 158508 KB Output is correct
13 Correct 9 ms 158508 KB Output is correct
14 Correct 14 ms 159036 KB Output is correct
15 Correct 132 ms 161808 KB Output is correct
16 Correct 171 ms 161808 KB Output is correct
17 Correct 136 ms 161808 KB Output is correct
18 Correct 166 ms 161808 KB Output is correct
19 Correct 414 ms 162072 KB Output is correct
20 Correct 247 ms 161940 KB Output is correct
21 Correct 473 ms 162072 KB Output is correct
22 Correct 498 ms 162072 KB Output is correct