#include<bits/stdc++.h>
#define int long long
using namespace std;
map<int,int> mapka1,mapka2;
int t[400000][2];
int32_t main()
{
cin.tie(0);
cout.tie(0);
ios_base::sync_with_stdio(0);
int n,x,y;
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>x>>y;
mapka1[x]++;
mapka2[y]++;
t[i][0]=x;
t[i][1]=y;
}
int wynik=0;
for(int i=1;i<=n;i++)
{
int a=mapka1[t[i][0]];
int b=mapka2[t[i][1]];
wynik+=(a-1)*(b-1);
}
cout<<wynik;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
380 KB |
Output is correct |
12 |
Correct |
8 ms |
1256 KB |
Output is correct |
13 |
Correct |
6 ms |
1236 KB |
Output is correct |
14 |
Correct |
11 ms |
1752 KB |
Output is correct |
15 |
Correct |
113 ms |
8028 KB |
Output is correct |
16 |
Correct |
113 ms |
8332 KB |
Output is correct |
17 |
Correct |
109 ms |
7840 KB |
Output is correct |
18 |
Correct |
109 ms |
7940 KB |
Output is correct |
19 |
Correct |
373 ms |
14724 KB |
Output is correct |
20 |
Correct |
214 ms |
11736 KB |
Output is correct |
21 |
Correct |
317 ms |
15576 KB |
Output is correct |
22 |
Correct |
331 ms |
15572 KB |
Output is correct |