#include <bits/stdc++.h>
#define MOD 1000000007
typedef long long ll;
using namespace std;
int x[1000000], y[1000000];
unordered_map<int, ll> um[2];
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n;
cin >> n;
for(int i = 1; i <= n; i++){
cin >> x[i] >> y[i];
um[0][x[i]]++;
um[1][y[i]]++;
}
ll ans = 0;
for(int i = 1; i <= n; i++){
ans += ((um[0][x[i]] - 1) * (um[1][y[i]] - 1));
}
cout << ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
316 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
316 KB |
Output is correct |
6 |
Correct |
1 ms |
332 KB |
Output is correct |
7 |
Correct |
1 ms |
320 KB |
Output is correct |
8 |
Correct |
1 ms |
320 KB |
Output is correct |
9 |
Correct |
1 ms |
332 KB |
Output is correct |
10 |
Correct |
1 ms |
332 KB |
Output is correct |
11 |
Correct |
1 ms |
364 KB |
Output is correct |
12 |
Correct |
5 ms |
840 KB |
Output is correct |
13 |
Correct |
5 ms |
956 KB |
Output is correct |
14 |
Correct |
5 ms |
1196 KB |
Output is correct |
15 |
Correct |
45 ms |
5884 KB |
Output is correct |
16 |
Correct |
48 ms |
6076 KB |
Output is correct |
17 |
Correct |
48 ms |
5836 KB |
Output is correct |
18 |
Correct |
40 ms |
5828 KB |
Output is correct |
19 |
Correct |
106 ms |
11180 KB |
Output is correct |
20 |
Correct |
100 ms |
8956 KB |
Output is correct |
21 |
Correct |
150 ms |
11856 KB |
Output is correct |
22 |
Correct |
123 ms |
11816 KB |
Output is correct |