#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define f first
#define s second
#define int ll
using namespace std;
const int inf = 1e9,N = 3e5+5,mod = 998244353;
int x[N],y[N];
map <int,int> cx,cy;
signed main() {
ios_base::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL);
int n;
cin>>n;
for (int i = 1; i <= n; i++){
cin>>x[i]>>y[i];
cx[x[i]]++;
cy[y[i]]++;
}
int ans=0;
for (int i=1;i<=n;i++){
ans += (cx[x[i]] - 1)*(cy[y[i]] - 1);
}
cout<<ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
328 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
328 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
324 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 |
340 KB |
Output is correct |
12 |
Correct |
6 ms |
1236 KB |
Output is correct |
13 |
Correct |
5 ms |
1236 KB |
Output is correct |
14 |
Correct |
10 ms |
1748 KB |
Output is correct |
15 |
Correct |
137 ms |
7892 KB |
Output is correct |
16 |
Correct |
155 ms |
8260 KB |
Output is correct |
17 |
Correct |
105 ms |
8012 KB |
Output is correct |
18 |
Correct |
109 ms |
7884 KB |
Output is correct |
19 |
Correct |
294 ms |
14764 KB |
Output is correct |
20 |
Correct |
195 ms |
11740 KB |
Output is correct |
21 |
Correct |
322 ms |
15568 KB |
Output is correct |
22 |
Correct |
318 ms |
15572 KB |
Output is correct |