#include <bits/stdc++.h>
using namespace std;
#define int ll
#define ll long long
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
const int sz = 1e5 + 5;
signed main(){
int n;
cin >> n;
vector<pair<int,int>>a(n);
map<int,int> cx, cy;
for(int i = 0; i < n; ++i){
cin >> a[i].first >> a[i].second;
cx[a[i].first]++;
cy[a[i].second]++;
}
int res = 0;
for(int i = 0; i < n; ++i){
int x, y;
tie(x, y) = a[i];
res += ((cx[x] - 1) * (cy[y] - 1));
}
cout << res << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 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 |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 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 |
7 ms |
1332 KB |
Output is correct |
13 |
Correct |
8 ms |
1440 KB |
Output is correct |
14 |
Correct |
13 ms |
1884 KB |
Output is correct |
15 |
Correct |
126 ms |
7988 KB |
Output is correct |
16 |
Correct |
146 ms |
8312 KB |
Output is correct |
17 |
Correct |
130 ms |
8020 KB |
Output is correct |
18 |
Correct |
138 ms |
8008 KB |
Output is correct |
19 |
Correct |
352 ms |
14644 KB |
Output is correct |
20 |
Correct |
257 ms |
11900 KB |
Output is correct |
21 |
Correct |
389 ms |
15660 KB |
Output is correct |
22 |
Correct |
383 ms |
15612 KB |
Output is correct |