#include<bits/stdc++.h>
#include<vector>
using namespace std;
#define pb push_back
#define ll long long
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const ll mod = 1e9 + 7 , N = 2e5 + 100;
int main(){
ios::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
ll n;cin >> n;
ll ans = 0;
map<ll , ll> mx , my;
vector<pair<ll , ll>> a(n + 1);
for(int i = 1;i <= n;i ++){
cin >> a[i].first >> a[i].second;
++ mx[a[i].first];
++ my[a[i].second];
}
for(int i = 1;i <= n;i ++){
ans += (mx[a[i].first] - 1) * (my[a[i].second] - 1);
}
cout << ans << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
320 KB |
Output is correct |
3 |
Correct |
0 ms |
320 KB |
Output is correct |
4 |
Correct |
1 ms |
320 KB |
Output is correct |
5 |
Correct |
1 ms |
320 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
320 KB |
Output is correct |
8 |
Correct |
0 ms |
340 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 |
1360 KB |
Output is correct |
13 |
Correct |
5 ms |
1236 KB |
Output is correct |
14 |
Correct |
10 ms |
1792 KB |
Output is correct |
15 |
Correct |
95 ms |
7864 KB |
Output is correct |
16 |
Correct |
104 ms |
8240 KB |
Output is correct |
17 |
Correct |
98 ms |
7888 KB |
Output is correct |
18 |
Correct |
105 ms |
7952 KB |
Output is correct |
19 |
Correct |
266 ms |
14868 KB |
Output is correct |
20 |
Correct |
191 ms |
11856 KB |
Output is correct |
21 |
Correct |
287 ms |
15644 KB |
Output is correct |
22 |
Correct |
280 ms |
15576 KB |
Output is correct |