#include <bits/stdc++.h>
using namespace std;
long long n, ans;
map<int, int> x, y;
int main()
{
cin.tie(NULL)->sync_with_stdio(false);
cin>>n;
vector<pair<int, int>> v(n);
for (int i=0; i<n; i++) cin>>v[i].first>>v[i].second, x[v[i].first]++, y[v[i].second]++;
for (int i=0; i<n; i++) ans+=(x[v[i].first]-1)*(y[v[i].second]-1);
cout<<ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 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 |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 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 |
7 ms |
1112 KB |
Output is correct |
13 |
Correct |
5 ms |
1136 KB |
Output is correct |
14 |
Correct |
9 ms |
1372 KB |
Output is correct |
15 |
Correct |
80 ms |
6228 KB |
Output is correct |
16 |
Correct |
96 ms |
6516 KB |
Output is correct |
17 |
Correct |
88 ms |
6292 KB |
Output is correct |
18 |
Correct |
86 ms |
6224 KB |
Output is correct |
19 |
Correct |
235 ms |
11600 KB |
Output is correct |
20 |
Correct |
164 ms |
9284 KB |
Output is correct |
21 |
Correct |
231 ms |
12124 KB |
Output is correct |
22 |
Correct |
248 ms |
12064 KB |
Output is correct |