/*
ID: samikgo1
TASK:
LANG: C++
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define f first
#define s second
//#define x first
//#define y second
const int INF = INT32_MAX;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
// freopen("measurement.in","r",stdin);
// freopen("measurement.out","w",stdout);
ll n;
cin >> n;
vector<pll> points(n);
for(pll&i:points)cin>>i.f>>i.s;
unordered_map<ll,ll> x_axis;
unordered_map<ll,ll> y_axis;
ll ans = 0;
for (pll &i: points) {
x_axis[i.first]++;
y_axis[i.second]++;
}
for (pll &i: points) {
ans+=(x_axis[i.first]-1)*(y_axis[i.second]-1);
}
cout << ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
316 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 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 |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
320 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
5 ms |
972 KB |
Output is correct |
13 |
Correct |
6 ms |
980 KB |
Output is correct |
14 |
Correct |
5 ms |
1364 KB |
Output is correct |
15 |
Correct |
39 ms |
6656 KB |
Output is correct |
16 |
Correct |
49 ms |
6928 KB |
Output is correct |
17 |
Correct |
36 ms |
6536 KB |
Output is correct |
18 |
Correct |
36 ms |
6540 KB |
Output is correct |
19 |
Correct |
91 ms |
13288 KB |
Output is correct |
20 |
Correct |
71 ms |
10408 KB |
Output is correct |
21 |
Correct |
97 ms |
14084 KB |
Output is correct |
22 |
Correct |
100 ms |
14156 KB |
Output is correct |