#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define fs first
#define sc second
#define tlll tuple<ll,ll,ll>
const int mxn = 1e5+10;
map<int,int> xcnt,ycnt;
pii arr[mxn];
int main(){
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int n;
cin>>n;
for(int i = 0;i<n;i++){
cin>>arr[i].fs>>arr[i].sc;
xcnt[arr[i].fs]++;
ycnt[arr[i].sc]++;
}
ll ans = 0;
for(int i = 0;i<n;i++){
ans += 1ll*(xcnt[arr[i].fs]-1)*(ycnt[arr[i].sc]-1);
}
cout<<ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
436 KB |
Output is correct |
4 |
Correct |
0 ms |
344 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 |
344 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
1 ms |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
6 ms |
860 KB |
Output is correct |
13 |
Correct |
5 ms |
860 KB |
Output is correct |
14 |
Correct |
7 ms |
1352 KB |
Output is correct |
15 |
Correct |
83 ms |
3924 KB |
Output is correct |
16 |
Runtime error |
53 ms |
7972 KB |
Execution killed with signal 11 |
17 |
Halted |
0 ms |
0 KB |
- |