#include "bits/stdc++.h"
using namespace std;
#define int long long
#define FOR(i, l, r) for(int i = l; i < r; i++)
#define snd second
#define fst first
#define pb push_back
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
vii ps;
map<int, int> xc, yc;
int N;
signed main(){
cin >> N;
FOR(i, 0, N){
int x, y;
cin >> x >> y;
ps.pb({x, y});
xc[x]++; yc[y]++;
}
int sum = 0;
for(ii &p : ps){
sum += (xc[p.fst]-1) * (yc[p.snd] - 1);
}
cout << sum;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
248 KB |
Output is correct |
2 |
Correct |
2 ms |
356 KB |
Output is correct |
3 |
Correct |
3 ms |
432 KB |
Output is correct |
4 |
Correct |
2 ms |
636 KB |
Output is correct |
5 |
Correct |
2 ms |
636 KB |
Output is correct |
6 |
Correct |
2 ms |
660 KB |
Output is correct |
7 |
Correct |
3 ms |
804 KB |
Output is correct |
8 |
Correct |
3 ms |
804 KB |
Output is correct |
9 |
Correct |
3 ms |
812 KB |
Output is correct |
10 |
Correct |
3 ms |
852 KB |
Output is correct |
11 |
Correct |
4 ms |
852 KB |
Output is correct |
12 |
Correct |
19 ms |
1720 KB |
Output is correct |
13 |
Correct |
21 ms |
1888 KB |
Output is correct |
14 |
Correct |
27 ms |
2608 KB |
Output is correct |
15 |
Correct |
312 ms |
8920 KB |
Output is correct |
16 |
Correct |
296 ms |
11492 KB |
Output is correct |
17 |
Correct |
252 ms |
13544 KB |
Output is correct |
18 |
Correct |
275 ms |
15708 KB |
Output is correct |
19 |
Correct |
886 ms |
28400 KB |
Output is correct |
20 |
Correct |
505 ms |
28400 KB |
Output is correct |
21 |
Correct |
787 ms |
38700 KB |
Output is correct |
22 |
Correct |
795 ms |
45196 KB |
Output is correct |