#include "museum.h"
using std::vector;
typedef long long lint;
int A[100], B[100], C[100];
int D[100][100], E[100][100], F[100][100];
int G[100][100][100];
lint CountSimilarPairs(vector<int> X, vector<int> Y, vector<int> Z) {
int n = X.size();
for(int i=0; i<n; i++){
int x=X[i]-1, y=Y[i]-1, z=Z[i]-1;
A[x]++, B[y]++, C[z]++;
D[x][y]++, E[y][z]++, F[z][x]++;
G[x][y][z]++;
}
lint ans = 0;
for(int i=0; i<n; i++){
int x=X[i]-1, y=Y[i]-1, z=Z[i]-1;
int now = A[x] + B[y] + C[z];
now -= D[x][y] + E[y][z] + F[z][x];
now += G[x][y][z];
now -= 1;
ans += now;
}
return ans/2;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
512 KB |
Output is correct |
4 |
Correct |
6 ms |
640 KB |
Output is correct |
5 |
Correct |
6 ms |
1792 KB |
Output is correct |
6 |
Correct |
6 ms |
2176 KB |
Output is correct |
7 |
Correct |
7 ms |
2944 KB |
Output is correct |
8 |
Correct |
6 ms |
512 KB |
Output is correct |
9 |
Correct |
8 ms |
3968 KB |
Output is correct |
10 |
Correct |
8 ms |
3968 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
512 KB |
Output is correct |
4 |
Correct |
6 ms |
640 KB |
Output is correct |
5 |
Correct |
6 ms |
1792 KB |
Output is correct |
6 |
Correct |
6 ms |
2176 KB |
Output is correct |
7 |
Correct |
7 ms |
2944 KB |
Output is correct |
8 |
Correct |
6 ms |
512 KB |
Output is correct |
9 |
Correct |
8 ms |
3968 KB |
Output is correct |
10 |
Correct |
8 ms |
3968 KB |
Output is correct |
11 |
Correct |
9 ms |
4480 KB |
Output is correct |
12 |
Correct |
17 ms |
1152 KB |
Output is correct |
13 |
Correct |
32 ms |
5496 KB |
Output is correct |
14 |
Correct |
43 ms |
6512 KB |
Output is correct |
15 |
Correct |
62 ms |
7408 KB |
Output is correct |
16 |
Correct |
77 ms |
5204 KB |
Output is correct |
17 |
Correct |
83 ms |
5352 KB |
Output is correct |
18 |
Correct |
91 ms |
6632 KB |
Output is correct |
19 |
Correct |
101 ms |
9204 KB |
Output is correct |
20 |
Correct |
100 ms |
9192 KB |
Output is correct |