#include <bits/extc++.h>
#define int long long
using namespace std;
using namespace __gnu_pbds;
map<int,int> x,y;
signed main() {
ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
int n; cin>>n;
pair<int,int> p [n];
for(int i=0; i<n; i++) {
cin>>p[i].first>>p[i].second;
x[p[i].first]++, y[p[i].second]++;;
}
int ans = 0;
for(int i=0; i<n; i++) {
ans += (x[p[i].first]-1) * (y[p[i].second]-1);
}
cout<<ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
456 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 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 |
1368 KB |
Output is correct |
13 |
Correct |
5 ms |
1372 KB |
Output is correct |
14 |
Correct |
8 ms |
1884 KB |
Output is correct |
15 |
Correct |
94 ms |
8020 KB |
Output is correct |
16 |
Correct |
90 ms |
8436 KB |
Output is correct |
17 |
Correct |
88 ms |
8260 KB |
Output is correct |
18 |
Correct |
84 ms |
8020 KB |
Output is correct |
19 |
Correct |
251 ms |
14604 KB |
Output is correct |
20 |
Correct |
168 ms |
11816 KB |
Output is correct |
21 |
Correct |
256 ms |
15768 KB |
Output is correct |
22 |
Correct |
252 ms |
15444 KB |
Output is correct |