#include<bits/stdc++.h>
using namespace std;
int x[300100], y[300100];
map<int,long long> mx, my;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n; cin >> n;
for (int i = 0; i < n; i++) {
cin >> x[i] >> y[i];
mx[x[i]]++; my[y[i]]++;
}
long long ans=0;
for (int i = 0; i < n; i++) ans+=(mx[x[i]]-1)*(my[y[i]]-1);
cout << ans;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
364 KB |
Output is correct |
2 |
Correct |
0 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 |
1 ms |
492 KB |
Output is correct |
12 |
Correct |
7 ms |
1260 KB |
Output is correct |
13 |
Correct |
7 ms |
1260 KB |
Output is correct |
14 |
Correct |
11 ms |
1772 KB |
Output is correct |
15 |
Correct |
132 ms |
7148 KB |
Output is correct |
16 |
Correct |
135 ms |
7656 KB |
Output is correct |
17 |
Correct |
125 ms |
7148 KB |
Output is correct |
18 |
Correct |
124 ms |
7148 KB |
Output is correct |
19 |
Correct |
351 ms |
12652 KB |
Output is correct |
20 |
Correct |
254 ms |
10348 KB |
Output is correct |
21 |
Correct |
394 ms |
13292 KB |
Output is correct |
22 |
Correct |
401 ms |
13292 KB |
Output is correct |