#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
ios_base::sync_with_stdio(0); cin.tie(0);
map<pair<int,int>, int> p;
map<int,int> x;
map<int,int> y;
int n; cin >> n;
for(int i = 0; i < n; i++){
int X, Y; cin >> X >> Y;
p[{X,Y}]++;
x[X]++;
y[Y]++;
}
int res = 0;
for(pair<pair<int,int>, int> a : p){
res += a.second * (x[a.first.first] - a.second) * (y[a.first.second] - a.second);
}
cout << res << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
508 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 |
504 KB |
Output is correct |
6 |
Correct |
1 ms |
504 KB |
Output is correct |
7 |
Correct |
1 ms |
336 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
1 ms |
764 KB |
Output is correct |
12 |
Correct |
10 ms |
1872 KB |
Output is correct |
13 |
Correct |
7 ms |
1872 KB |
Output is correct |
14 |
Correct |
12 ms |
2128 KB |
Output is correct |
15 |
Correct |
118 ms |
12756 KB |
Output is correct |
16 |
Correct |
131 ms |
13384 KB |
Output is correct |
17 |
Correct |
118 ms |
12764 KB |
Output is correct |
18 |
Correct |
112 ms |
12616 KB |
Output is correct |
19 |
Correct |
380 ms |
27720 KB |
Output is correct |
20 |
Correct |
300 ms |
21180 KB |
Output is correct |
21 |
Correct |
408 ms |
29768 KB |
Output is correct |
22 |
Correct |
406 ms |
29664 KB |
Output is correct |