#include <bits/stdc++.h>
#define lsb(x) (x & (-x))
#define ll long long
#define ull unsigned long long
#define ld long double
// 217
// 44
using namespace std;
const int MAXN = (int) 3e5;
pair <int, int> pts[MAXN + 1];
map <int, int> frx, fry;
int main() {
//ifstream cin("A.in");
//ofstream cout("A.out");
int i, n;
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
cin >> n;
for(i = 1; i <= n; i++) {
int x, y;
cin >> x >> y;
pts[i] = {x, y};
frx[x]++;
fry[y]++;
//fr[{x, y}]++;
}
ll ans = 0;
for(i = 1; i <= n; i++) {
ans += 1LL * (frx[pts[i].first] - 1) * (fry[pts[i].second] - 1);
}
cout << ans;
//cin.close();
//cout.close();
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
380 KB |
Output is correct |
2 |
Correct |
2 ms |
508 KB |
Output is correct |
3 |
Correct |
5 ms |
516 KB |
Output is correct |
4 |
Correct |
2 ms |
516 KB |
Output is correct |
5 |
Correct |
2 ms |
516 KB |
Output is correct |
6 |
Correct |
2 ms |
516 KB |
Output is correct |
7 |
Correct |
2 ms |
516 KB |
Output is correct |
8 |
Correct |
2 ms |
516 KB |
Output is correct |
9 |
Correct |
2 ms |
532 KB |
Output is correct |
10 |
Correct |
3 ms |
572 KB |
Output is correct |
11 |
Correct |
3 ms |
708 KB |
Output is correct |
12 |
Correct |
21 ms |
1292 KB |
Output is correct |
13 |
Correct |
9 ms |
1456 KB |
Output is correct |
14 |
Correct |
17 ms |
2040 KB |
Output is correct |
15 |
Correct |
171 ms |
7204 KB |
Output is correct |
16 |
Correct |
170 ms |
9512 KB |
Output is correct |
17 |
Correct |
161 ms |
10716 KB |
Output is correct |
18 |
Correct |
174 ms |
10716 KB |
Output is correct |
19 |
Correct |
480 ms |
12264 KB |
Output is correct |
20 |
Correct |
324 ms |
15956 KB |
Output is correct |
21 |
Correct |
492 ms |
20028 KB |
Output is correct |
22 |
Correct |
475 ms |
20028 KB |
Output is correct |