#include <bits/stdc++.h>
using namespace std;
typedef long long llo;
#define mp make_pair
#define pb push_back
#define a first
#define b second
#define endl '\n'
llo n;
llo aa[300001];
llo bb[300001];
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin>>n;
map<llo,llo> ss;
map<llo,llo> tt;
for(llo i=0;i<n;i++){
cin>>aa[i]>>bb[i];
ss[aa[i]]++;
tt[bb[i]]++;
}
llo ans=0;
for(llo i=0;i<n;i++){
ans+=(ss[aa[i]]-1)*(tt[bb[i]]-1);
}
cout<<ans<<endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
0 ms |
256 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
1 ms |
384 KB |
Output is correct |
8 |
Correct |
1 ms |
384 KB |
Output is correct |
9 |
Correct |
1 ms |
384 KB |
Output is correct |
10 |
Correct |
1 ms |
384 KB |
Output is correct |
11 |
Correct |
1 ms |
384 KB |
Output is correct |
12 |
Correct |
7 ms |
1100 KB |
Output is correct |
13 |
Correct |
7 ms |
1152 KB |
Output is correct |
14 |
Correct |
11 ms |
1536 KB |
Output is correct |
15 |
Correct |
136 ms |
5880 KB |
Output is correct |
16 |
Correct |
151 ms |
6008 KB |
Output is correct |
17 |
Correct |
141 ms |
5880 KB |
Output is correct |
18 |
Correct |
141 ms |
5880 KB |
Output is correct |
19 |
Correct |
393 ms |
8824 KB |
Output is correct |
20 |
Correct |
274 ms |
7544 KB |
Output is correct |
21 |
Correct |
429 ms |
9084 KB |
Output is correct |
22 |
Correct |
431 ms |
9208 KB |
Output is correct |