#include <bits/stdc++.h>
#define int long long
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
#define pb push_back
using namespace std;
signed main(){
ios_base::sync_with_stdio();
cin.tie(0);cout.tie(0);
int n;
cin>>n;
map <int,vector <int> > xy,yx;
for(int i=0;i<n;i++){
int x,y;cin>>x>>y;
xy[x].pb(y);
yx[y].pb(x);
}
int ans=0;
for(auto i : xy){
for(auto y : i.ss){
ans+=((i.ss.size()-1)*(yx[y].size()-1));
}
}
cout<<ans<<"\n";
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
556 KB |
Output is correct |
4 |
Correct |
1 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 |
0 ms |
600 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
9 ms |
1628 KB |
Output is correct |
13 |
Correct |
10 ms |
1828 KB |
Output is correct |
14 |
Correct |
12 ms |
2396 KB |
Output is correct |
15 |
Correct |
129 ms |
10624 KB |
Output is correct |
16 |
Correct |
138 ms |
11392 KB |
Output is correct |
17 |
Correct |
133 ms |
10836 KB |
Output is correct |
18 |
Correct |
126 ms |
10720 KB |
Output is correct |
19 |
Correct |
365 ms |
20560 KB |
Output is correct |
20 |
Correct |
259 ms |
16420 KB |
Output is correct |
21 |
Correct |
410 ms |
21824 KB |
Output is correct |
22 |
Correct |
372 ms |
21752 KB |
Output is correct |