#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int x[n+1], y[n+1];
map<int, int>ax;
map<int, int>ay;
for (int i=1;i<=n;i++){
cin>>x[i]>>y[i];
ax[x[i]+1e9]++;
ay[y[i]+1e9]++;
}
long long res=0;
for (int i=1;i<=n;i++){
res+=(ax[x[i]+1e9]-1)*(ay[y[i]+1e9]-1);
}
cout<<res;
}
# |
결과 |
실행 시간 |
메모리 |
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 |
14 ms |
1004 KB |
Output is correct |
13 |
Correct |
15 ms |
1088 KB |
Output is correct |
14 |
Correct |
20 ms |
1388 KB |
Output is correct |
15 |
Correct |
227 ms |
5536 KB |
Output is correct |
16 |
Correct |
236 ms |
5504 KB |
Output is correct |
17 |
Correct |
215 ms |
5412 KB |
Output is correct |
18 |
Correct |
209 ms |
5484 KB |
Output is correct |
19 |
Correct |
609 ms |
7148 KB |
Output is correct |
20 |
Correct |
422 ms |
6636 KB |
Output is correct |
21 |
Correct |
624 ms |
7492 KB |
Output is correct |
22 |
Correct |
632 ms |
7536 KB |
Output is correct |