#include <bits/stdc++.h>
#define ll long long
#define endl "\n"
#define ios ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0);
using namespace std;
int main() {
//ios
int n;
cin >> n;
ll x[n], y[n];
map <ll, ll> m1, m2;
for (int i = 0; i < n; ++ i) {
cin >> x[i] >> y[i];
m1[x[i]] ++;
m2[y[i]] ++;
}
ll ans = 0;
for (int i = 0; i < n; ++ i) {
ans += (m1[x[i]] - 1) * (m2[y[i]] - 1);
}
cout << ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 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 |
296 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
2 ms |
352 KB |
Output is correct |
10 |
Correct |
2 ms |
332 KB |
Output is correct |
11 |
Correct |
3 ms |
332 KB |
Output is correct |
12 |
Correct |
14 ms |
1204 KB |
Output is correct |
13 |
Correct |
14 ms |
1244 KB |
Output is correct |
14 |
Correct |
19 ms |
1720 KB |
Output is correct |
15 |
Correct |
213 ms |
7900 KB |
Output is correct |
16 |
Correct |
271 ms |
8208 KB |
Output is correct |
17 |
Correct |
241 ms |
7860 KB |
Output is correct |
18 |
Correct |
263 ms |
7868 KB |
Output is correct |
19 |
Correct |
619 ms |
14692 KB |
Output is correct |
20 |
Correct |
394 ms |
11808 KB |
Output is correct |
21 |
Correct |
772 ms |
15596 KB |
Output is correct |
22 |
Correct |
601 ms |
15500 KB |
Output is correct |