#include <bits/stdc++.h>
#define DIM 300010
using namespace std;
map <int,int> x,y;
pair <int,int> v[DIM];
int n,i;
int main (){
//ifstream cin ("date.in");
//ofstream cout ("date.out");
cin>>n;
for (i=1;i<=n;i++){
cin>>v[i].first>>v[i].second;
x[v[i].first]++;
y[v[i].second]++;
}
long long sol = 0;
for (i=1;i<=n;i++)
sol += 1LL * (x[v[i].first] - 1) * (y[v[i].second] - 1);
cout<<sol;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
1 ms |
364 KB |
Output is correct |
7 |
Correct |
1 ms |
364 KB |
Output is correct |
8 |
Correct |
1 ms |
364 KB |
Output is correct |
9 |
Correct |
1 ms |
364 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |
11 |
Correct |
2 ms |
364 KB |
Output is correct |
12 |
Correct |
12 ms |
1004 KB |
Output is correct |
13 |
Correct |
13 ms |
1132 KB |
Output is correct |
14 |
Correct |
18 ms |
1388 KB |
Output is correct |
15 |
Correct |
217 ms |
4588 KB |
Output is correct |
16 |
Correct |
202 ms |
4716 KB |
Output is correct |
17 |
Correct |
216 ms |
4608 KB |
Output is correct |
18 |
Correct |
188 ms |
4588 KB |
Output is correct |
19 |
Correct |
555 ms |
5660 KB |
Output is correct |
20 |
Correct |
380 ms |
4972 KB |
Output is correct |
21 |
Correct |
572 ms |
5740 KB |
Output is correct |
22 |
Correct |
584 ms |
5740 KB |
Output is correct |