#include <bits/stdc++.h>
using namespace std;
#define ld long double
#define ll long long
int main(){
int n, x, y;
cin>>n;
set<vector<int>> se;
for (int i = 0; i < n; i++){
cin>>x>>y;
se.insert({x, y});
}
map<int, ll> mx, my;
for (auto el : se){
mx[el[0]]++;
my[el[1]]++;
}
ll ans = 0;
for (auto el : se){
ans += (mx[el[0]] - 1) * (my[el[1]] - 1);
}
cout<<ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
336 KB |
Output is correct |
8 |
Correct |
1 ms |
504 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
2 ms |
336 KB |
Output is correct |
11 |
Correct |
2 ms |
592 KB |
Output is correct |
12 |
Correct |
18 ms |
2024 KB |
Output is correct |
13 |
Correct |
14 ms |
2128 KB |
Output is correct |
14 |
Correct |
18 ms |
2472 KB |
Output is correct |
15 |
Correct |
211 ms |
15932 KB |
Output is correct |
16 |
Correct |
218 ms |
16968 KB |
Output is correct |
17 |
Correct |
202 ms |
15748 KB |
Output is correct |
18 |
Correct |
210 ms |
15688 KB |
Output is correct |
19 |
Correct |
635 ms |
36468 KB |
Output is correct |
20 |
Correct |
400 ms |
27536 KB |
Output is correct |
21 |
Correct |
715 ms |
39148 KB |
Output is correct |
22 |
Correct |
735 ms |
39148 KB |
Output is correct |