#include<bits/stdc++.h>
#define maxn 300000
#define ll long long
using namespace std;
pair<ll,ll> a[maxn+5];
map<ll, ll> u;
map<ll, ll> o;
int main() {
ll n;
cin >>n;
for(ll i = 1; i <= n; i++) {
cin >>a[i].first >>a[i].second;
u[a[i].first]++;
o[a[i].second]++;
}
ll s = 0;
for(ll i = 1; i <= n; i++) {
s += (u[a[i].first]-1) * (o[a[i].second]-1);
}
cout<<s;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
372 KB |
Output is correct |
3 |
Correct |
2 ms |
448 KB |
Output is correct |
4 |
Correct |
2 ms |
468 KB |
Output is correct |
5 |
Correct |
2 ms |
544 KB |
Output is correct |
6 |
Correct |
2 ms |
716 KB |
Output is correct |
7 |
Correct |
2 ms |
716 KB |
Output is correct |
8 |
Correct |
2 ms |
716 KB |
Output is correct |
9 |
Correct |
3 ms |
716 KB |
Output is correct |
10 |
Correct |
3 ms |
716 KB |
Output is correct |
11 |
Correct |
3 ms |
716 KB |
Output is correct |
12 |
Correct |
16 ms |
1552 KB |
Output is correct |
13 |
Correct |
17 ms |
1672 KB |
Output is correct |
14 |
Correct |
26 ms |
2420 KB |
Output is correct |
15 |
Correct |
262 ms |
7716 KB |
Output is correct |
16 |
Correct |
323 ms |
8784 KB |
Output is correct |
17 |
Correct |
273 ms |
8784 KB |
Output is correct |
18 |
Correct |
277 ms |
8784 KB |
Output is correct |
19 |
Correct |
788 ms |
11820 KB |
Output is correct |
20 |
Correct |
619 ms |
11820 KB |
Output is correct |
21 |
Correct |
852 ms |
11976 KB |
Output is correct |
22 |
Correct |
811 ms |
13048 KB |
Output is correct |