#include <bits/stdc++.h>
using namespace std;
int main(){
int n; cin >> n;
map<int,int> X, Y;
vector<pair<int,int>> v(n);
for(auto &x : v){cin >> x.first >> x.second;X[x.first]++, Y[x.second]++;}
long long ans = 0;
for(int i = 0; i < n; ++i){
ans+=(X[v[i].first]-1)*(Y[v[i].second]-1);
}
cout << ans << "\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
0 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
1 ms |
364 KB |
Output is correct |
7 |
Correct |
1 ms |
364 KB |
Output is correct |
8 |
Correct |
1 ms |
364 KB |
Output is correct |
9 |
Correct |
1 ms |
364 KB |
Output is correct |
10 |
Correct |
1 ms |
384 KB |
Output is correct |
11 |
Correct |
2 ms |
492 KB |
Output is correct |
12 |
Correct |
12 ms |
1024 KB |
Output is correct |
13 |
Correct |
13 ms |
1132 KB |
Output is correct |
14 |
Correct |
18 ms |
1388 KB |
Output is correct |
15 |
Correct |
193 ms |
6244 KB |
Output is correct |
16 |
Correct |
224 ms |
6628 KB |
Output is correct |
17 |
Correct |
202 ms |
6248 KB |
Output is correct |
18 |
Correct |
200 ms |
6244 KB |
Output is correct |
19 |
Correct |
552 ms |
11748 KB |
Output is correct |
20 |
Correct |
402 ms |
9444 KB |
Output is correct |
21 |
Correct |
597 ms |
12264 KB |
Output is correct |
22 |
Correct |
598 ms |
12328 KB |
Output is correct |