#include<bits/stdc++.h>
using namespace std;
const int MAXN = 3e5;
int N;
int X[MAXN + 5], Y[MAXN + 5];
map<int, int> cntX, cntY;
int main() {
ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
cin >> N;
for (int i = 0; i < N; i++) {
cin >> X[i] >> Y[i];
cntX[X[i]]++;
cntY[Y[i]]++;
}
long long ans = 0;
for (int i = 0; i < N; i++) {
ans += 1ll * (cntX[X[i]] - 1) * (cntY[Y[i]] - 1);
}
cout << ans << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 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 |
2392 KB |
Output is correct |
5 |
Correct |
1 ms |
2396 KB |
Output is correct |
6 |
Correct |
1 ms |
2424 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 |
2468 KB |
Output is correct |
10 |
Correct |
1 ms |
2520 KB |
Output is correct |
11 |
Correct |
1 ms |
2392 KB |
Output is correct |
12 |
Correct |
5 ms |
3164 KB |
Output is correct |
13 |
Correct |
5 ms |
3164 KB |
Output is correct |
14 |
Correct |
9 ms |
3416 KB |
Output is correct |
15 |
Correct |
80 ms |
7508 KB |
Output is correct |
16 |
Correct |
95 ms |
7892 KB |
Output is correct |
17 |
Correct |
83 ms |
7504 KB |
Output is correct |
18 |
Correct |
85 ms |
7508 KB |
Output is correct |
19 |
Correct |
230 ms |
11504 KB |
Output is correct |
20 |
Correct |
169 ms |
10036 KB |
Output is correct |
21 |
Correct |
239 ms |
12068 KB |
Output is correct |
22 |
Correct |
242 ms |
12112 KB |
Output is correct |