#include<bits/stdc++.h>
using namespace std;
map<long long,long long>x,y;
int main()
{
int n;
cin>>n;
vector<pair<int,int> >v;
while(n--)
{
int a,b;
cin>>a>>b;
v.push_back({a,b});
x[a]++;
y[b]++;
}
long long ans=0;
for(pair<int,int>d:v)
{
ans+=(x[d.first]-1)*(y[d.second]-1);
}
cout<<ans;
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 |
304 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
304 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
300 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
2 ms |
340 KB |
Output is correct |
12 |
Correct |
11 ms |
1116 KB |
Output is correct |
13 |
Correct |
13 ms |
1220 KB |
Output is correct |
14 |
Correct |
16 ms |
1640 KB |
Output is correct |
15 |
Correct |
195 ms |
7256 KB |
Output is correct |
16 |
Correct |
184 ms |
7396 KB |
Output is correct |
17 |
Correct |
205 ms |
7148 KB |
Output is correct |
18 |
Correct |
186 ms |
7108 KB |
Output is correct |
19 |
Correct |
450 ms |
14320 KB |
Output is correct |
20 |
Correct |
319 ms |
10152 KB |
Output is correct |
21 |
Correct |
542 ms |
14348 KB |
Output is correct |
22 |
Correct |
494 ms |
14368 KB |
Output is correct |