#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int x[300000];
int y[300000];
void solve() {
map<int, int> xs;
map<int, int> ys;
int n;
cin >> n;
for(int i = 0; i < n; i++) {
cin >> x[i] >> y[i];
xs[x[i]]++;
ys[y[i]]++;
}
ll ret = 0;
for(int i = 0; i < n; i++) {
ret += (xs[x[i]] - 1LL) * (ys[y[i]] - 1LL);
}
cout << ret << endl;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
solve();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
512 KB |
Output is correct |
3 |
Correct |
2 ms |
512 KB |
Output is correct |
4 |
Correct |
2 ms |
512 KB |
Output is correct |
5 |
Correct |
2 ms |
520 KB |
Output is correct |
6 |
Correct |
3 ms |
524 KB |
Output is correct |
7 |
Correct |
2 ms |
528 KB |
Output is correct |
8 |
Correct |
2 ms |
660 KB |
Output is correct |
9 |
Correct |
3 ms |
660 KB |
Output is correct |
10 |
Correct |
3 ms |
732 KB |
Output is correct |
11 |
Correct |
3 ms |
732 KB |
Output is correct |
12 |
Correct |
11 ms |
1304 KB |
Output is correct |
13 |
Correct |
10 ms |
1600 KB |
Output is correct |
14 |
Correct |
15 ms |
2076 KB |
Output is correct |
15 |
Correct |
181 ms |
7104 KB |
Output is correct |
16 |
Correct |
195 ms |
9708 KB |
Output is correct |
17 |
Correct |
167 ms |
11680 KB |
Output is correct |
18 |
Correct |
164 ms |
13772 KB |
Output is correct |
19 |
Correct |
491 ms |
21332 KB |
Output is correct |
20 |
Correct |
322 ms |
25136 KB |
Output is correct |
21 |
Correct |
481 ms |
32168 KB |
Output is correct |
22 |
Correct |
428 ms |
34424 KB |
Output is correct |