#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
int n; cin >> n;
pair<int, int> points[n]; map<int, int> X, Y;
for(int i = 0; i < n; i++){
cin >> points[i].first >> points[i].second;
X[points[i].first]++; Y[points[i].second]++;
}
int ans = 0;
for(int i = 0; i < n; i++) ans += (X[points[i].first] - 1) * (Y[points[i].second] - 1);
cout << ans << '\n';
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
296 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 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 |
13 ms |
1108 KB |
Output is correct |
13 |
Correct |
11 ms |
1208 KB |
Output is correct |
14 |
Correct |
16 ms |
1684 KB |
Output is correct |
15 |
Correct |
164 ms |
7852 KB |
Output is correct |
16 |
Correct |
170 ms |
8268 KB |
Output is correct |
17 |
Correct |
157 ms |
7796 KB |
Output is correct |
18 |
Correct |
158 ms |
7852 KB |
Output is correct |
19 |
Correct |
423 ms |
14692 KB |
Output is correct |
20 |
Correct |
313 ms |
11724 KB |
Output is correct |
21 |
Correct |
456 ms |
15584 KB |
Output is correct |
22 |
Correct |
462 ms |
15576 KB |
Output is correct |