#include <bits/stdc++.h>
using namespace std;
const int N = 2e5+10;
int x[N], y[N];
map<int,int> X, Y;
int main() {
int n;
cin >> n;
for(int i = 1; i <= n; ++i) {
cin >> x[i] >> y[i];
++X[x[i]];
++Y[y[i]];
}
long long ans = 0;
for(int i = 1; i <= n; ++i) {
ans += (long long)(X[x[i]] - 1) * (Y[y[i]] - 1);
}
cout << ans << '\n';
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
1 ms |
364 KB |
Output is correct |
7 |
Correct |
1 ms |
364 KB |
Output is correct |
8 |
Correct |
1 ms |
364 KB |
Output is correct |
9 |
Correct |
1 ms |
364 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |
11 |
Correct |
2 ms |
364 KB |
Output is correct |
12 |
Correct |
15 ms |
1004 KB |
Output is correct |
13 |
Correct |
14 ms |
1152 KB |
Output is correct |
14 |
Correct |
18 ms |
1388 KB |
Output is correct |
15 |
Correct |
206 ms |
6252 KB |
Output is correct |
16 |
Correct |
216 ms |
6636 KB |
Output is correct |
17 |
Correct |
195 ms |
6252 KB |
Output is correct |
18 |
Correct |
197 ms |
6252 KB |
Output is correct |
19 |
Runtime error |
313 ms |
14444 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
20 |
Halted |
0 ms |
0 KB |
- |