# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
765530 | nguyen31hoang08minh2003 | Star triangles (IZhO11_triangle) | C++17 | 240 ms | 12216 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;
template<class X, class Y>
bool minimize(X &x, const Y &y) {
if (x > y) {
x = y;
return true;
}
return false;
}
template<class X, class Y>
bool maximize(X &x, const Y &y) {
if (x < y) {
x = y;
return true;
}
return false;
}
constexpr int MAX_N = 300005;
int N, X[MAX_N], Y[MAX_N];
map<int, int> x, y;
long long result;
signed main() {
#ifdef LOCAL
freopen("input.INP", "r", stdin);
// freopen("log.TXT", "w", stderr);
// freopen("output.out", "w", stdout);
#endif
cin.tie(0) -> sync_with_stdio(0);
cout.tie(0);
cin >> N;
for (int i = 1; i <= N; ++i) {
cin >> X[i] >> Y[i];
++x[X[i]];
++y[Y[i]];
}
for (int i = 1; i <= N; ++i)
result += (x[X[i]] - 1LL) * (y[Y[i]] - 1LL);
cout << result << '\n';
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |