#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];
int main(){
suhu
cin>>n;
for(int i=1;i<=n;i++){
cin>>a[i]>>b[i];
}
ll ans=0;
for(int i=1;i<=n;i++){
ll x=0,y=0;
for(int j=1;j<=n;j++){
if(j==i)continue;
if(a[i]==a[j])x++;
if(b[i]==b[j])y++;
}
ans+=x*y;
}
cout<<ans<<"\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
1 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 |
0 ms |
2396 KB |
Output is correct |
7 |
Correct |
3 ms |
2504 KB |
Output is correct |
8 |
Correct |
1 ms |
2396 KB |
Output is correct |
9 |
Correct |
1 ms |
2648 KB |
Output is correct |
10 |
Correct |
1 ms |
2392 KB |
Output is correct |
11 |
Correct |
2 ms |
2392 KB |
Output is correct |
12 |
Correct |
167 ms |
2712 KB |
Output is correct |
13 |
Correct |
92 ms |
2652 KB |
Output is correct |
14 |
Correct |
95 ms |
2788 KB |
Output is correct |
15 |
Execution timed out |
2059 ms |
6740 KB |
Time limit exceeded |
16 |
Halted |
0 ms |
0 KB |
- |