#include <bits/stdc++.h>
using namespace std;
#define fs first
#define ss second
#define ll long long
int main(){
int n;
cin >> n;
map<ll, ll> X, Y;
vector<pair<ll, ll>> a(n);
for(int i = 0; i < n; i ++){
cin >> a[i].fs >> a[i].ss;
X[a[i].fs] ++;
Y[a[i].ss] ++;
}
ll ans = 0;
for(int i = 0; i < n; i ++)
ans += 1ll * (X[a[i].fs] - 1) * (Y[a[i].ss] - 1);
cout << ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
220 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
2 ms |
300 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
8 ms |
1216 KB |
Output is correct |
13 |
Correct |
9 ms |
1236 KB |
Output is correct |
14 |
Correct |
12 ms |
1748 KB |
Output is correct |
15 |
Correct |
135 ms |
8040 KB |
Output is correct |
16 |
Correct |
136 ms |
8260 KB |
Output is correct |
17 |
Correct |
131 ms |
7824 KB |
Output is correct |
18 |
Correct |
124 ms |
7836 KB |
Output is correct |
19 |
Correct |
350 ms |
14852 KB |
Output is correct |
20 |
Correct |
246 ms |
11768 KB |
Output is correct |
21 |
Correct |
386 ms |
15540 KB |
Output is correct |
22 |
Correct |
416 ms |
15532 KB |
Output is correct |