#include <bits/stdc++.h>
#define ll long long
#define fi first
#define se second
const ll MOD=1e9+7;
using namespace std;
ll N;
pair <ll,ll> pr[300005];
map <ll,ll> x;
map <ll,ll> y;
int main(){
cin>>N;
for(int i=1;i<=N;i++){
cin>>pr[i].fi>>pr[i].se;
x[pr[i].fi]++;
y[pr[i].se]++;
}
ll ans=0;
for(int i=1;i<=N;i++){
ans+=(x[pr[i].fi]-1)*(y[pr[i].se]-1);
}
cout<<ans<<endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
300 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
300 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
300 KB |
Output is correct |
9 |
Correct |
1 ms |
332 KB |
Output is correct |
10 |
Correct |
1 ms |
304 KB |
Output is correct |
11 |
Correct |
1 ms |
308 KB |
Output is correct |
12 |
Correct |
12 ms |
1212 KB |
Output is correct |
13 |
Correct |
13 ms |
1212 KB |
Output is correct |
14 |
Correct |
17 ms |
1620 KB |
Output is correct |
15 |
Correct |
161 ms |
7876 KB |
Output is correct |
16 |
Correct |
172 ms |
8148 KB |
Output is correct |
17 |
Correct |
171 ms |
7936 KB |
Output is correct |
18 |
Correct |
198 ms |
7876 KB |
Output is correct |
19 |
Correct |
454 ms |
10976 KB |
Output is correct |
20 |
Correct |
399 ms |
9816 KB |
Output is correct |
21 |
Correct |
532 ms |
11300 KB |
Output is correct |
22 |
Correct |
540 ms |
11372 KB |
Output is correct |