#include <iostream>
#include <map>
using namespace std;
int main () {
int n;
cin >> n;
pair<int, int> pos[n];
for (int i=0; i<n; i++) {
cin >> pos[i].first >> pos[i].second;
}
map<int, int> rows;
for (int i=0; i<n; i++) {
rows[pos[i].first]++;
}
map<int, int> cols;
for (int i=0; i<n; i++) {
cols[pos[i].second]++;
}
long long o = 0;
for (int i=0; i<n; i++) {
o += 1ll*(rows[pos[i].first]-1)*(cols[pos[i].second]-1);
}
cout << o << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
1 ms |
364 KB |
Output is correct |
7 |
Correct |
1 ms |
364 KB |
Output is correct |
8 |
Correct |
1 ms |
364 KB |
Output is correct |
9 |
Correct |
1 ms |
364 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |
11 |
Correct |
2 ms |
364 KB |
Output is correct |
12 |
Correct |
12 ms |
1004 KB |
Output is correct |
13 |
Correct |
13 ms |
1004 KB |
Output is correct |
14 |
Correct |
17 ms |
1388 KB |
Output is correct |
15 |
Correct |
182 ms |
6124 KB |
Output is correct |
16 |
Correct |
197 ms |
6508 KB |
Output is correct |
17 |
Correct |
179 ms |
6124 KB |
Output is correct |
18 |
Correct |
179 ms |
6124 KB |
Output is correct |
19 |
Correct |
492 ms |
11500 KB |
Output is correct |
20 |
Correct |
358 ms |
9204 KB |
Output is correct |
21 |
Correct |
534 ms |
12396 KB |
Output is correct |
22 |
Correct |
528 ms |
12140 KB |
Output is correct |