#include <bits/stdc++.h>
using namespace std;
#define int long long
#define Foxfur ios_base::sync_with_stdio(0);cin.tie(NULL);
int32_t main()
{
Foxfur
int n; cin >> n;
int maxn = 3e5+5;
map <int,int> jmlx;
map <int, int> jmly;
int arrx[maxn];
int arry[maxn];
for(int i=0; i<n; i++)
{
cin >> arrx[i] >> arry[i];
jmlx[arrx[i]]++;
jmly[arry[i]]++;
}
int ans=0;
for(int i=0; i<n; i++)
{
ans += (jmlx[arrx[i]]-1) * (jmly[arry[i]]-1);
}
cout << ans << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
4956 KB |
Output is correct |
2 |
Correct |
3 ms |
4956 KB |
Output is correct |
3 |
Correct |
2 ms |
4956 KB |
Output is correct |
4 |
Correct |
2 ms |
4956 KB |
Output is correct |
5 |
Correct |
3 ms |
5088 KB |
Output is correct |
6 |
Correct |
2 ms |
4956 KB |
Output is correct |
7 |
Correct |
3 ms |
4956 KB |
Output is correct |
8 |
Correct |
2 ms |
5068 KB |
Output is correct |
9 |
Correct |
3 ms |
4956 KB |
Output is correct |
10 |
Correct |
4 ms |
4956 KB |
Output is correct |
11 |
Correct |
3 ms |
4956 KB |
Output is correct |
12 |
Correct |
7 ms |
5548 KB |
Output is correct |
13 |
Correct |
7 ms |
5724 KB |
Output is correct |
14 |
Correct |
10 ms |
6012 KB |
Output is correct |
15 |
Correct |
87 ms |
8788 KB |
Output is correct |
16 |
Correct |
93 ms |
9040 KB |
Output is correct |
17 |
Correct |
95 ms |
9044 KB |
Output is correct |
18 |
Correct |
103 ms |
9032 KB |
Output is correct |
19 |
Correct |
231 ms |
9044 KB |
Output is correct |
20 |
Correct |
169 ms |
9040 KB |
Output is correct |
21 |
Correct |
245 ms |
9044 KB |
Output is correct |
22 |
Correct |
260 ms |
9040 KB |
Output is correct |