# include <bits/stdc++.h>
# define ll long long
using namespace std;
int main() {
int N;
cin>>N;
int X[N], Y[N];
map<int, int> x, y;
for(int i=0;i<N;i++) {
cin>>X[i]>>Y[i];
x[X[i]]++;
y[Y[i]]++;
}
ll ans;
ans = 0ll;
for(int i=0;i<N;i++) {
ans += (ll) (x[X[i]]-1ll) * (ll) (y[Y[i]] - 1ll);
}
cout<<ans<<endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
296 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 |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
296 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
304 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
2 ms |
312 KB |
Output is correct |
12 |
Correct |
12 ms |
964 KB |
Output is correct |
13 |
Correct |
13 ms |
1056 KB |
Output is correct |
14 |
Correct |
15 ms |
1364 KB |
Output is correct |
15 |
Correct |
162 ms |
6116 KB |
Output is correct |
16 |
Correct |
200 ms |
6412 KB |
Output is correct |
17 |
Correct |
189 ms |
6216 KB |
Output is correct |
18 |
Correct |
164 ms |
6052 KB |
Output is correct |
19 |
Correct |
506 ms |
11544 KB |
Output is correct |
20 |
Correct |
323 ms |
9164 KB |
Output is correct |
21 |
Correct |
528 ms |
12076 KB |
Output is correct |
22 |
Correct |
546 ms |
12232 KB |
Output is correct |