#include <iostream>
#include <cmath>
#include <cctype>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <deque>
#include <stack>
#include <unordered_set>
#include <sstream>
#include <cstring>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <random>
#include <cfloat>
#include <chrono>
#include <bitset>
#include <complex>
#include <immintrin.h>
#include <cassert>
int main() {
int32_t n;
std::cin >> n;
std::map<int32_t, int32_t> per_x, per_y;
std::pair<int32_t, int32_t>* points = new std::pair<int32_t, int32_t>[n];
for(int32_t i = 0; i < n; i++) {
int32_t x, y;
std::cin >> x >> y;
per_x[x]++;
per_y[y]++;
points[i] = {x, y};
}
int64_t ans = 0;
for(int32_t i = 0; i < n; i++)
ans += (int64_t)(per_x[points[i].first] - 1) * (per_y[points[i].second] - 1);
std::cout << ans;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
288 KB |
Output is correct |
2 |
Correct |
0 ms |
288 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
292 KB |
Output is correct |
11 |
Correct |
2 ms |
368 KB |
Output is correct |
12 |
Correct |
10 ms |
896 KB |
Output is correct |
13 |
Correct |
12 ms |
1008 KB |
Output is correct |
14 |
Correct |
15 ms |
1356 KB |
Output is correct |
15 |
Correct |
161 ms |
6132 KB |
Output is correct |
16 |
Correct |
199 ms |
6440 KB |
Output is correct |
17 |
Correct |
159 ms |
6080 KB |
Output is correct |
18 |
Correct |
159 ms |
6048 KB |
Output is correct |
19 |
Correct |
421 ms |
11452 KB |
Output is correct |
20 |
Correct |
354 ms |
9164 KB |
Output is correct |
21 |
Correct |
507 ms |
12080 KB |
Output is correct |
22 |
Correct |
588 ms |
12120 KB |
Output is correct |