#include <bits/stdc++.h>
using namespace std;
using ll = long long;
map<int, int> xc;
map<int, int> yc;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
pair<int, int> a[n];
for(int i=0; i< n; i++){
cin >> a[i].first >> a[i].second;
xc[a[i].first]++;
yc[a[i].second]++;
}
ll ans=0;
for(int i=0; i< n; i++){
ans+=(xc[a[i].first]-1)*1ll*(yc[a[i].second]-1);
}
cout << ans << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
344 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
5 ms |
944 KB |
Output is correct |
13 |
Correct |
5 ms |
1116 KB |
Output is correct |
14 |
Correct |
8 ms |
1476 KB |
Output is correct |
15 |
Correct |
87 ms |
6456 KB |
Output is correct |
16 |
Correct |
88 ms |
6596 KB |
Output is correct |
17 |
Correct |
81 ms |
6228 KB |
Output is correct |
18 |
Correct |
80 ms |
6172 KB |
Output is correct |
19 |
Correct |
224 ms |
11704 KB |
Output is correct |
20 |
Correct |
156 ms |
9296 KB |
Output is correct |
21 |
Correct |
232 ms |
12236 KB |
Output is correct |
22 |
Correct |
245 ms |
12304 KB |
Output is correct |