Submission #17678

# Submission time Handle Problem Language Result Execution time Memory
17678 2016-01-12T06:52:38 Z chrome Star triangles (IZhO11_triangle) C++
0 / 100
0 ms 157972 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;
}
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 157972 KB open (syscall #2) was called by the program (disallowed syscall)
2 Runtime error 0 ms 157972 KB open (syscall #2) was called by the program (disallowed syscall)
3 Runtime error 0 ms 157972 KB open (syscall #2) was called by the program (disallowed syscall)
4 Runtime error 0 ms 157972 KB open (syscall #2) was called by the program (disallowed syscall)
5 Runtime error 0 ms 157972 KB open (syscall #2) was called by the program (disallowed syscall)
6 Runtime error 0 ms 157972 KB open (syscall #2) was called by the program (disallowed syscall)
7 Runtime error 0 ms 157972 KB open (syscall #2) was called by the program (disallowed syscall)
8 Runtime error 0 ms 157972 KB open (syscall #2) was called by the program (disallowed syscall)
9 Runtime error 0 ms 157972 KB open (syscall #2) was called by the program (disallowed syscall)
10 Runtime error 0 ms 157972 KB open (syscall #2) was called by the program (disallowed syscall)
11 Runtime error 0 ms 157972 KB open (syscall #2) was called by the program (disallowed syscall)
12 Runtime error 0 ms 157972 KB open (syscall #2) was called by the program (disallowed syscall)
13 Runtime error 0 ms 157972 KB open (syscall #2) was called by the program (disallowed syscall)
14 Runtime error 0 ms 157972 KB open (syscall #2) was called by the program (disallowed syscall)
15 Runtime error 0 ms 157972 KB open (syscall #2) was called by the program (disallowed syscall)
16 Runtime error 0 ms 157972 KB open (syscall #2) was called by the program (disallowed syscall)
17 Runtime error 0 ms 157972 KB open (syscall #2) was called by the program (disallowed syscall)
18 Runtime error 0 ms 157972 KB open (syscall #2) was called by the program (disallowed syscall)
19 Runtime error 0 ms 157972 KB open (syscall #2) was called by the program (disallowed syscall)
20 Runtime error 0 ms 157972 KB open (syscall #2) was called by the program (disallowed syscall)
21 Runtime error 0 ms 157972 KB open (syscall #2) was called by the program (disallowed syscall)
22 Runtime error 0 ms 157972 KB open (syscall #2) was called by the program (disallowed syscall)