#include<bits/stdc++.h>
#define suhu ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long ll;
const ll MAXN=3e5+5;
const ll inf=1e18;
ll n,a[MAXN],b[MAXN];
map<ll,ll>x;
map<ll,ll>y;
int main(){
suhu
cin>>n;
for(int i=1;i<=n;i++){
cin>>a[i]>>b[i];
x[a[i]]++;
y[b[i]]++;
}
ll ans=0;
for(int i=1;i<=n;i++){
ans+=(x[a[i]]-1)*(y[b[i]]-1);
}
cout<<ans<<"\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2392 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
0 ms |
2396 KB |
Output is correct |
4 |
Correct |
1 ms |
2396 KB |
Output is correct |
5 |
Correct |
1 ms |
2396 KB |
Output is correct |
6 |
Correct |
1 ms |
2392 KB |
Output is correct |
7 |
Correct |
1 ms |
2396 KB |
Output is correct |
8 |
Correct |
1 ms |
2396 KB |
Output is correct |
9 |
Correct |
1 ms |
2396 KB |
Output is correct |
10 |
Correct |
1 ms |
2396 KB |
Output is correct |
11 |
Correct |
1 ms |
2396 KB |
Output is correct |
12 |
Correct |
5 ms |
3164 KB |
Output is correct |
13 |
Correct |
5 ms |
3164 KB |
Output is correct |
14 |
Correct |
8 ms |
3420 KB |
Output is correct |
15 |
Correct |
85 ms |
8604 KB |
Output is correct |
16 |
Correct |
94 ms |
8676 KB |
Output is correct |
17 |
Correct |
85 ms |
8548 KB |
Output is correct |
18 |
Correct |
87 ms |
8780 KB |
Output is correct |
19 |
Correct |
226 ms |
8980 KB |
Output is correct |
20 |
Correct |
164 ms |
8760 KB |
Output is correct |
21 |
Correct |
257 ms |
9128 KB |
Output is correct |
22 |
Correct |
245 ms |
9240 KB |
Output is correct |