#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
int n,ans;
vector<vector<int>> v;
map<int,int> row,col;
signed main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
cin >> n;
for(int i=1;i<=n;i++){
int a,b;
cin >> a >> b;
v.push_back({a,b});
row[a]++;
col[b]++;
}
for(vector<int> i:v){
ans += (row[i[0]]-1LL)*(col[i[1]]-1LL);
}
cout << ans << "\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
324 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
316 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
332 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 |
1608 KB |
Output is correct |
13 |
Correct |
6 ms |
1680 KB |
Output is correct |
14 |
Correct |
9 ms |
2056 KB |
Output is correct |
15 |
Correct |
113 ms |
11856 KB |
Output is correct |
16 |
Correct |
103 ms |
12564 KB |
Output is correct |
17 |
Correct |
93 ms |
11764 KB |
Output is correct |
18 |
Correct |
100 ms |
11792 KB |
Output is correct |
19 |
Correct |
271 ms |
30796 KB |
Output is correct |
20 |
Correct |
225 ms |
19656 KB |
Output is correct |
21 |
Correct |
293 ms |
30804 KB |
Output is correct |
22 |
Correct |
351 ms |
30804 KB |
Output is correct |