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