#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pb push_back
#define dbg(x) cerr << #x << " " << x << "\n"
int main () {
ios::sync_with_stdio (false);
cin.tie (0); cout.tie (0);
int n;
cin >> n;
vector <pair <int, int>> points;
map <int, int> onX, onY;
for (int i = 1; i <= n; i++) {
int x, y;
cin >> x >> y;
points.pb ({x, y});
onX[x]++;
onY[y]++;
}
ll ans = 0;
for (pair <int, int> p : points)
ans += 1ll * (onX[p.first] - 1) * (onY[p.second] - 1);
cout << ans << "\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
492 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
1 ms |
364 KB |
Output is correct |
7 |
Correct |
1 ms |
364 KB |
Output is correct |
8 |
Correct |
1 ms |
364 KB |
Output is correct |
9 |
Correct |
1 ms |
384 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |
11 |
Correct |
1 ms |
364 KB |
Output is correct |
12 |
Correct |
8 ms |
1004 KB |
Output is correct |
13 |
Correct |
8 ms |
1132 KB |
Output is correct |
14 |
Correct |
11 ms |
1388 KB |
Output is correct |
15 |
Correct |
134 ms |
6240 KB |
Output is correct |
16 |
Correct |
142 ms |
6496 KB |
Output is correct |
17 |
Correct |
133 ms |
6272 KB |
Output is correct |
18 |
Correct |
148 ms |
6224 KB |
Output is correct |
19 |
Correct |
375 ms |
13404 KB |
Output is correct |
20 |
Correct |
295 ms |
9308 KB |
Output is correct |
21 |
Correct |
391 ms |
13404 KB |
Output is correct |
22 |
Correct |
422 ms |
13404 KB |
Output is correct |