#include <bits/stdc++.h>
#define ll long long
#define f first
#define s second
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
ll n;
cin>>n;
map<ll,ll> ax;
map<ll,ll> ay;
vector<pair<ll,ll>> le(n+1);
for(int i = 1;i<=n;i++) {
ll x,y;
cin>>x>>y;
le[i] = {x,y};
ax[x]++;
ay[y]++;
}
ll ans = 0;
for (int i=1;i<=n;i++) {
ans += (ax[le[i].f]-1)*(ay[le[i].s]-1);
}
cout<<ans<<endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
592 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Correct |
2 ms |
336 KB |
Output is correct |
6 |
Correct |
2 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
336 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
1 ms |
528 KB |
Output is correct |
12 |
Correct |
6 ms |
1360 KB |
Output is correct |
13 |
Correct |
6 ms |
1316 KB |
Output is correct |
14 |
Correct |
10 ms |
1884 KB |
Output is correct |
15 |
Correct |
96 ms |
7976 KB |
Output is correct |
16 |
Correct |
107 ms |
8424 KB |
Output is correct |
17 |
Correct |
98 ms |
7880 KB |
Output is correct |
18 |
Correct |
104 ms |
8020 KB |
Output is correct |
19 |
Correct |
281 ms |
14664 KB |
Output is correct |
20 |
Correct |
197 ms |
11968 KB |
Output is correct |
21 |
Correct |
304 ms |
15660 KB |
Output is correct |
22 |
Correct |
299 ms |
15828 KB |
Output is correct |