#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 += 1ll * (jmlx[arrx[i]]-1) * (jmly[arry[i]]-1);
}
cout << ans << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
4956 KB |
Output is correct |
2 |
Correct |
3 ms |
4956 KB |
Output is correct |
3 |
Correct |
3 ms |
4956 KB |
Output is correct |
4 |
Correct |
3 ms |
4956 KB |
Output is correct |
5 |
Correct |
2 ms |
5064 KB |
Output is correct |
6 |
Correct |
3 ms |
4956 KB |
Output is correct |
7 |
Correct |
3 ms |
4956 KB |
Output is correct |
8 |
Correct |
3 ms |
4956 KB |
Output is correct |
9 |
Correct |
3 ms |
4956 KB |
Output is correct |
10 |
Correct |
3 ms |
4956 KB |
Output is correct |
11 |
Correct |
3 ms |
5212 KB |
Output is correct |
12 |
Correct |
7 ms |
5724 KB |
Output is correct |
13 |
Correct |
7 ms |
5980 KB |
Output is correct |
14 |
Correct |
10 ms |
6408 KB |
Output is correct |
15 |
Correct |
87 ms |
11120 KB |
Output is correct |
16 |
Correct |
94 ms |
11416 KB |
Output is correct |
17 |
Correct |
86 ms |
11068 KB |
Output is correct |
18 |
Correct |
86 ms |
11092 KB |
Output is correct |
19 |
Correct |
234 ms |
15156 KB |
Output is correct |
20 |
Correct |
174 ms |
13392 KB |
Output is correct |
21 |
Correct |
248 ms |
15440 KB |
Output is correct |
22 |
Correct |
249 ms |
15684 KB |
Output is correct |