#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define pb push_back
#define all(a) a.begin(), a.end()
#define endl "\n"
void printVector(vector<int> a){
for (auto x: a) cout << x << " ";
cout << endl;
}
void solve(){
int n; cin >> n;
map<int, int> abc;
map<int, int> oord;
vector<pair<int, int>> points;
FOR(i,0,n){
int x, y; cin >> x >> y;
points.pb({x, y});
abc[x]++;
oord[y]++;
}
int ans = 0;
for (auto point: points){
ans += (abc[point.first]-1)*(oord[point.second]-1);
}
cout << ans << endl;
}
int32_t main(){
ios::sync_with_stdio(false);cin.tie(nullptr);
int t = 1; // cin >> t;
while (t--) solve();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
336 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
2 ms |
592 KB |
Output is correct |
12 |
Correct |
6 ms |
1360 KB |
Output is correct |
13 |
Correct |
6 ms |
1372 KB |
Output is correct |
14 |
Correct |
9 ms |
1828 KB |
Output is correct |
15 |
Correct |
101 ms |
8572 KB |
Output is correct |
16 |
Correct |
113 ms |
8636 KB |
Output is correct |
17 |
Correct |
111 ms |
8664 KB |
Output is correct |
18 |
Correct |
110 ms |
8648 KB |
Output is correct |
19 |
Correct |
275 ms |
20656 KB |
Output is correct |
20 |
Correct |
188 ms |
13680 KB |
Output is correct |
21 |
Correct |
292 ms |
20592 KB |
Output is correct |
22 |
Correct |
281 ms |
20656 KB |
Output is correct |