#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 |
2396 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 |
2 ms |
2396 KB |
Output is correct |
7 |
Correct |
1 ms |
2396 KB |
Output is correct |
8 |
Correct |
1 ms |
2396 KB |
Output is correct |
9 |
Correct |
1 ms |
2648 KB |
Output is correct |
10 |
Correct |
1 ms |
2396 KB |
Output is correct |
11 |
Correct |
1 ms |
2396 KB |
Output is correct |
12 |
Correct |
5 ms |
3164 KB |
Output is correct |
13 |
Correct |
8 ms |
3164 KB |
Output is correct |
14 |
Correct |
12 ms |
3672 KB |
Output is correct |
15 |
Correct |
98 ms |
8620 KB |
Output is correct |
16 |
Correct |
97 ms |
8532 KB |
Output is correct |
17 |
Correct |
89 ms |
8440 KB |
Output is correct |
18 |
Correct |
87 ms |
8624 KB |
Output is correct |
19 |
Correct |
237 ms |
9060 KB |
Output is correct |
20 |
Correct |
178 ms |
8960 KB |
Output is correct |
21 |
Correct |
249 ms |
9088 KB |
Output is correct |
22 |
Correct |
254 ms |
9040 KB |
Output is correct |