# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1198785 | Hamed_Ghaffari | Star triangles (IZhO11_triangle) | C++20 | 230 ms | 5864 KiB |
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int MXN = 3e5+5;
int n, x[MXN], y[MXN];
map<int, int> rw, cl;
int32_t main() {
cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
cin >> n;
for(int i=1; i<=n; i++) {
cin >> x[i] >> y[i];
rw[x[i]]++;
cl[y[i]]++;
}
ll ans = 0;
for(int i=1; i<=n; i++) {
ans += 1ll*(rw[x[i]]-1)*(cl[y[i]]-1);
}
cout << ans << '\n';
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |