#include "museum.h"
int ca[105], cb[105], cc[105], cab[105][105], cac[105][105], cbc[105][105], cabc[105][105][105];
long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G) {
int N = B.size();
long long ans = 0;
for (int i=0;i<N;i++) {
ans += ca[B[i]] + cb[T[i]] + cc[G[i]] - cab[B[i]][T[i]] - cac[B[i]][G[i]] - cbc[T[i]][G[i]] + cabc[B[i]][T[i]][G[i]];
ca[B[i]]++;
cb[T[i]]++;
cc[G[i]]++;
cab[B[i]][T[i]]++;
cac[B[i]][G[i]]++;
cbc[T[i]][G[i]]++;
cabc[B[i]][T[i]][G[i]]++;
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
256 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 |
7 ms |
2048 KB |
Output is correct |
7 |
Correct |
9 ms |
3072 KB |
Output is correct |
8 |
Correct |
7 ms |
512 KB |
Output is correct |
9 |
Correct |
8 ms |
4224 KB |
Output is correct |
10 |
Correct |
9 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 |
256 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 |
7 ms |
2048 KB |
Output is correct |
7 |
Correct |
9 ms |
3072 KB |
Output is correct |
8 |
Correct |
7 ms |
512 KB |
Output is correct |
9 |
Correct |
8 ms |
4224 KB |
Output is correct |
10 |
Correct |
9 ms |
3968 KB |
Output is correct |
11 |
Correct |
11 ms |
4992 KB |
Output is correct |
12 |
Correct |
17 ms |
1152 KB |
Output is correct |
13 |
Correct |
33 ms |
5624 KB |
Output is correct |
14 |
Correct |
47 ms |
6896 KB |
Output is correct |
15 |
Correct |
62 ms |
7792 KB |
Output is correct |
16 |
Correct |
82 ms |
5224 KB |
Output is correct |
17 |
Correct |
85 ms |
5096 KB |
Output is correct |
18 |
Correct |
93 ms |
6508 KB |
Output is correct |
19 |
Correct |
100 ms |
9704 KB |
Output is correct |
20 |
Correct |
99 ms |
9708 KB |
Output is correct |