#include <bits/stdc++.h>
using namespace std;
#define futaba ios_base::sync_with_stdio(false); cin.tie(NULL);
#define rio return 0;
#define ll long long
// Fun things are fun. //
ll x[300005], y[300005];
int main() {
// freopen("generate.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
futaba
int n;
cin >> n;
map<ll, ll> cntx, cnty;
for(int i = 1; i <= n; i++) {
cin >> x[i] >> y[i];
cntx[x[i]]++;
cnty[y[i]]++;
}
ll ans = 0;
for(int i = 1; i <= n; i++) ans += ((cntx[x[i]] - 1) * (cnty[y[i]] - 1));
cout << ans << '\n';
rio
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
1 ms |
2392 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
1 ms |
2396 KB |
Output is correct |
5 |
Correct |
1 ms |
2396 KB |
Output is correct |
6 |
Correct |
1 ms |
2396 KB |
Output is correct |
7 |
Correct |
1 ms |
2392 KB |
Output is correct |
8 |
Correct |
1 ms |
2392 KB |
Output is correct |
9 |
Correct |
1 ms |
2396 KB |
Output is correct |
10 |
Correct |
2 ms |
2508 KB |
Output is correct |
11 |
Correct |
1 ms |
2396 KB |
Output is correct |
12 |
Correct |
5 ms |
3220 KB |
Output is correct |
13 |
Correct |
5 ms |
3164 KB |
Output is correct |
14 |
Correct |
11 ms |
3560 KB |
Output is correct |
15 |
Correct |
84 ms |
8628 KB |
Output is correct |
16 |
Correct |
92 ms |
8436 KB |
Output is correct |
17 |
Correct |
86 ms |
8532 KB |
Output is correct |
18 |
Correct |
86 ms |
8432 KB |
Output is correct |
19 |
Correct |
235 ms |
9040 KB |
Output is correct |
20 |
Correct |
167 ms |
8788 KB |
Output is correct |
21 |
Correct |
264 ms |
9040 KB |
Output is correct |
22 |
Correct |
245 ms |
9016 KB |
Output is correct |