#include <bits/stdc++.h>
#define ii unordered_map<int,int>
#define vi vector<int>
#define vii vector<pair<int,int>>
using namespace std;
void setIO() {
cin.tie(0)->sync_with_stdio(0);
}
void solve() {
int n,ans = 0;
cin >> n;
ii fx,fy;
vi X(n),Y(n);
for(int i = 0;i < n;++i) {
cin >> X[i] >> Y[i];
++fx[X[i]];
++fy[Y[i]];
}
for(int i = 0;i < n;++i)
ans += (fx[X[i]]-1)*(fy[Y[i]]-1);
cout << ans;
}
int main() {
setIO();
solve();
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
460 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
3 ms |
860 KB |
Output is correct |
13 |
Correct |
3 ms |
964 KB |
Output is correct |
14 |
Correct |
5 ms |
1368 KB |
Output is correct |
15 |
Correct |
30 ms |
5900 KB |
Output is correct |
16 |
Correct |
32 ms |
6548 KB |
Output is correct |
17 |
Correct |
30 ms |
5900 KB |
Output is correct |
18 |
Correct |
30 ms |
5920 KB |
Output is correct |
19 |
Correct |
74 ms |
11248 KB |
Output is correct |
20 |
Correct |
56 ms |
8964 KB |
Output is correct |
21 |
Correct |
84 ms |
11768 KB |
Output is correct |
22 |
Correct |
79 ms |
11872 KB |
Output is correct |