#include <bits/stdc++.h>
using namespace std;
int x[300005], y[300005];
map<int, int> mpx, mpy;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n;
cin >> n;
for (int i=1; i<=n; i++)
{
cin >> x[i] >> y[i];
mpx[x[i]]++;
mpy[y[i]]++;
}
long long ans=0;
for (int i=1; i<=n; i++)
ans+=(mpx[x[i]]-1LL)*(mpy[y[i]]-1);
cout << ans;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
280 KB |
Output is correct |
7 |
Correct |
1 ms |
328 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
344 KB |
Output is correct |
12 |
Correct |
6 ms |
980 KB |
Output is correct |
13 |
Correct |
5 ms |
1080 KB |
Output is correct |
14 |
Correct |
9 ms |
1368 KB |
Output is correct |
15 |
Correct |
101 ms |
6092 KB |
Output is correct |
16 |
Correct |
112 ms |
6496 KB |
Output is correct |
17 |
Correct |
97 ms |
6092 KB |
Output is correct |
18 |
Correct |
94 ms |
6280 KB |
Output is correct |
19 |
Correct |
323 ms |
11428 KB |
Output is correct |
20 |
Correct |
229 ms |
9252 KB |
Output is correct |
21 |
Correct |
293 ms |
12068 KB |
Output is correct |
22 |
Correct |
291 ms |
12176 KB |
Output is correct |