#include <iostream>
#include <set>
#include <map>
#include <algorithm>
using namespace std;
#define sz(s) (int)(s.size())
#define eb emplace_back
#define all(x) x.begin(), x.end()
const int N = 2e6;
const int NN = 4e3;
#define ll long long
map <int, int> cntx, cnty;
int x[N], y[N];
void solve() {
int n;
cin >> n;
for (int i = 1; i <= n; ++ i) {
cin >> x[i] >> y[i];
++cntx[x[i]];
++cnty[y[i]];
}
ll res = 0;
for (int i = 1; i <= n; ++ i)
res += ((cntx[x[i]] - 1) * (cnty[y[i]] - 1));
cout << res;
}
int main () {
solve();
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
508 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
3 ms |
376 KB |
Output is correct |
10 |
Correct |
3 ms |
376 KB |
Output is correct |
11 |
Correct |
4 ms |
376 KB |
Output is correct |
12 |
Correct |
19 ms |
1016 KB |
Output is correct |
13 |
Correct |
22 ms |
1016 KB |
Output is correct |
14 |
Correct |
28 ms |
1400 KB |
Output is correct |
15 |
Correct |
300 ms |
6236 KB |
Output is correct |
16 |
Correct |
323 ms |
6648 KB |
Output is correct |
17 |
Correct |
288 ms |
6324 KB |
Output is correct |
18 |
Correct |
293 ms |
6136 KB |
Output is correct |
19 |
Correct |
817 ms |
11704 KB |
Output is correct |
20 |
Correct |
592 ms |
9420 KB |
Output is correct |
21 |
Correct |
906 ms |
12448 KB |
Output is correct |
22 |
Correct |
856 ms |
12380 KB |
Output is correct |