#include <bits/stdc++.h>
#define f first
#define s second
using namespace std;
int main()
{
int n;
cin>>n;
vector<pair<int, int>> tacke(n);
int t,m;
for(int i=0; i < n; i++){
cin>>t;
cin>>m;
tacke[i] = make_pair(t,m);
}
map<int, int> x;
map<int, int> y;
for(int i=0; i < n; i++)x[tacke[i].f]++;
for(int i=0; i < n; i++)y[tacke[i].s]++;
long long rez=0;
for(int i=0; i < n; i++){
rez+=(x[tacke[i].f]-1)*(y[tacke[i].s]-1);
}
cout<<rez;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
440 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
8 ms |
960 KB |
Output is correct |
13 |
Correct |
9 ms |
976 KB |
Output is correct |
14 |
Correct |
11 ms |
1372 KB |
Output is correct |
15 |
Correct |
125 ms |
6456 KB |
Output is correct |
16 |
Correct |
129 ms |
6480 KB |
Output is correct |
17 |
Correct |
121 ms |
6288 KB |
Output is correct |
18 |
Correct |
117 ms |
6048 KB |
Output is correct |
19 |
Correct |
356 ms |
11624 KB |
Output is correct |
20 |
Correct |
235 ms |
9348 KB |
Output is correct |
21 |
Correct |
360 ms |
12296 KB |
Output is correct |
22 |
Correct |
344 ms |
12108 KB |
Output is correct |