#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
map<ll, int> datx;
map<ll, int> daty;
int n; cin >> n;
vector <pair<ll, ll>> titik;
for (int i=0;i<n;i++) {
ll x, y; cin >> x >> y;
titik.push_back({x, y});
datx[x]++;
daty[y]++;
}
ll ans = 0;
for (auto i:titik) {
ans+= (datx[i.first]-1)*(daty[i.second]-1);
}
cout << ans << endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
600 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
12 ms |
1368 KB |
Output is correct |
13 |
Correct |
9 ms |
1372 KB |
Output is correct |
14 |
Correct |
17 ms |
1752 KB |
Output is correct |
15 |
Correct |
129 ms |
7352 KB |
Output is correct |
16 |
Correct |
154 ms |
7700 KB |
Output is correct |
17 |
Correct |
156 ms |
7440 KB |
Output is correct |
18 |
Correct |
144 ms |
7292 KB |
Output is correct |
19 |
Correct |
389 ms |
16756 KB |
Output is correct |
20 |
Correct |
304 ms |
10892 KB |
Output is correct |
21 |
Correct |
423 ms |
17016 KB |
Output is correct |
22 |
Correct |
453 ms |
16664 KB |
Output is correct |