#include <bits/stdc++.h>
using namespace std;
#define int long long
#define sp << " " <<
#define nl << "\n"
signed main(){
cin.tie(0)->sync_with_stdio(0);
map<int, int> x, y;
int n; cin >> n;
pair<int, int> a[n];
for(auto &i : a) cin >> i.first >> i.second, ++x[i.first], ++y[i.second];
int ans = 0;
for(auto i : a) ans += (x[i.first]-1LL)*(y[i.second]-1LL);
cout << ans;
}
# |
결과 |
실행 시간 |
메모리 |
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 |
8 ms |
1132 KB |
Output is correct |
13 |
Correct |
7 ms |
1132 KB |
Output is correct |
14 |
Correct |
12 ms |
1516 KB |
Output is correct |
15 |
Correct |
147 ms |
5868 KB |
Output is correct |
16 |
Correct |
153 ms |
6124 KB |
Output is correct |
17 |
Correct |
126 ms |
5740 KB |
Output is correct |
18 |
Correct |
123 ms |
5740 KB |
Output is correct |
19 |
Correct |
340 ms |
8812 KB |
Output is correct |
20 |
Correct |
255 ms |
7532 KB |
Output is correct |
21 |
Correct |
446 ms |
9068 KB |
Output is correct |
22 |
Correct |
376 ms |
9068 KB |
Output is correct |