# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
17679 | chrome | Star triangles (IZhO11_triangle) | C++98 | 498 ms | 162072 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 |
---|---|---|---|---|
Fetching results... |