#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) x.begin(),x.end()
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;cin>>n;
map<int,int> x,y;
vector<int> a(n),b(n);
for(int i=0;i<n;i++){
cin>>a[i]>>b[i];
x[a[i]]++;
y[b[i]]++;
}
int ans=0;
for(int i=0;i<n;i++){
ans+=(x[a[i]]-1)*(y[b[i]]-1);
}
cout<<ans<<endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
320 KB |
Output is correct |
8 |
Correct |
0 ms |
324 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 |
340 KB |
Output is correct |
12 |
Correct |
7 ms |
1132 KB |
Output is correct |
13 |
Correct |
5 ms |
1236 KB |
Output is correct |
14 |
Correct |
9 ms |
1768 KB |
Output is correct |
15 |
Correct |
99 ms |
7884 KB |
Output is correct |
16 |
Correct |
112 ms |
8292 KB |
Output is correct |
17 |
Correct |
107 ms |
7876 KB |
Output is correct |
18 |
Correct |
99 ms |
7856 KB |
Output is correct |
19 |
Correct |
265 ms |
14752 KB |
Output is correct |
20 |
Correct |
200 ms |
11764 KB |
Output is correct |
21 |
Correct |
300 ms |
15560 KB |
Output is correct |
22 |
Correct |
288 ms |
15572 KB |
Output is correct |