# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
17679 | chrome | 별들과 삼각형 (IZhO11_triangle) | C++98 | 498 ms | 162072 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |