#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n;
ll ans = 0;
cin >> n;
vector<int> x(n), y(n);
map<int, int> mpX, mpY;
for (int i = 0; i < n; i++) {
cin >> x[i] >> y[i];
mpX[x[i]]++;
mpY[y[i]]++;
}
for (int i = 0; i < n; i++) {
ans += (ll)(mpX[x[i]] - 1) * (mpY[y[i]] - 1);
}
cout << ans << "\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
500 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
0 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 |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
5 ms |
1116 KB |
Output is correct |
13 |
Correct |
5 ms |
996 KB |
Output is correct |
14 |
Correct |
8 ms |
1556 KB |
Output is correct |
15 |
Correct |
82 ms |
6228 KB |
Output is correct |
16 |
Correct |
90 ms |
6620 KB |
Output is correct |
17 |
Correct |
82 ms |
6160 KB |
Output is correct |
18 |
Correct |
80 ms |
6224 KB |
Output is correct |
19 |
Correct |
219 ms |
11676 KB |
Output is correct |
20 |
Correct |
158 ms |
9264 KB |
Output is correct |
21 |
Correct |
228 ms |
12116 KB |
Output is correct |
22 |
Correct |
238 ms |
12144 KB |
Output is correct |