#include <bits/stdc++.h>
using namespace std;
#define nyahalo ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define otsumiko exit(0);
#define mikodanye priority_queue<pair<long long, long long>, vector<pair<long long, long long> >, greater<pair<long long, long long> > >
#define mikochi priority_queue<long long, vector<long long>, greater<long long> >
long long x[300069], y[300069];
int main() {
nyahalo
long long n, ans = 0;
cin >> n;
map<long long, long long> mpx, mpy;
for (long long i=1; i<=n; i++) {
cin >> x[i] >> y[i];
mpx[x[i]]++;
mpy[y[i]]++;
}
for (long long i=1; i<=n; i++) {
ans += (mpx[x[i]]-1)*(mpy[y[i]]-1);
}
cout << ans << "\n";
otsumiko
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
332 KB |
Output is correct |
8 |
Correct |
1 ms |
332 KB |
Output is correct |
9 |
Correct |
1 ms |
332 KB |
Output is correct |
10 |
Correct |
1 ms |
320 KB |
Output is correct |
11 |
Correct |
1 ms |
332 KB |
Output is correct |
12 |
Correct |
8 ms |
1228 KB |
Output is correct |
13 |
Correct |
6 ms |
1224 KB |
Output is correct |
14 |
Correct |
9 ms |
1688 KB |
Output is correct |
15 |
Correct |
124 ms |
7932 KB |
Output is correct |
16 |
Correct |
115 ms |
8316 KB |
Output is correct |
17 |
Correct |
115 ms |
7936 KB |
Output is correct |
18 |
Correct |
132 ms |
7932 KB |
Output is correct |
19 |
Correct |
355 ms |
14684 KB |
Output is correct |
20 |
Correct |
211 ms |
11736 KB |
Output is correct |
21 |
Correct |
374 ms |
15484 KB |
Output is correct |
22 |
Correct |
347 ms |
15544 KB |
Output is correct |