#include "museum.h"
int cnt[105][105][105];
long long res = 0;
long long get(long long s){
return s * (s - 1) / 2;
}
long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G) {
int n = B.size();
for(int i = 0; i < n; i++){
int a = B[i];
int b = T[i];
int c = G[i];
cnt[a][0][0]++;
cnt[0][b][0]++;
cnt[0][0][c]++;
cnt[a][b][0]++;
cnt[0][b][c]++;
cnt[a][0][c]++;
cnt[a][b][c]++;
}
for(int i = 0; i <= 100; i++){
for(int j = 0; j <= 100; j++){
for(int l = 0; l <= 100; l++){
int t = 3;
if(i == 0) t--;
if(j == 0) t--;
if(l == 0) t--;
res += (t % 2 == 1 ? 1 : -1) * get(cnt[i][j][l]);
}
}
}
return res;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
384 KB |
Output is correct |
2 |
Correct |
8 ms |
384 KB |
Output is correct |
3 |
Correct |
8 ms |
384 KB |
Output is correct |
4 |
Correct |
10 ms |
640 KB |
Output is correct |
5 |
Correct |
9 ms |
2048 KB |
Output is correct |
6 |
Correct |
8 ms |
2432 KB |
Output is correct |
7 |
Correct |
10 ms |
3328 KB |
Output is correct |
8 |
Correct |
9 ms |
512 KB |
Output is correct |
9 |
Correct |
10 ms |
4352 KB |
Output is correct |
10 |
Correct |
11 ms |
4224 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
384 KB |
Output is correct |
2 |
Correct |
8 ms |
384 KB |
Output is correct |
3 |
Correct |
8 ms |
384 KB |
Output is correct |
4 |
Correct |
10 ms |
640 KB |
Output is correct |
5 |
Correct |
9 ms |
2048 KB |
Output is correct |
6 |
Correct |
8 ms |
2432 KB |
Output is correct |
7 |
Correct |
10 ms |
3328 KB |
Output is correct |
8 |
Correct |
9 ms |
512 KB |
Output is correct |
9 |
Correct |
10 ms |
4352 KB |
Output is correct |
10 |
Correct |
11 ms |
4224 KB |
Output is correct |
11 |
Correct |
12 ms |
4864 KB |
Output is correct |
12 |
Correct |
20 ms |
1152 KB |
Output is correct |
13 |
Correct |
47 ms |
5620 KB |
Output is correct |
14 |
Correct |
42 ms |
6900 KB |
Output is correct |
15 |
Correct |
59 ms |
7788 KB |
Output is correct |
16 |
Correct |
88 ms |
5228 KB |
Output is correct |
17 |
Correct |
83 ms |
5356 KB |
Output is correct |
18 |
Correct |
88 ms |
6504 KB |
Output is correct |
19 |
Correct |
96 ms |
9580 KB |
Output is correct |
20 |
Correct |
97 ms |
9600 KB |
Output is correct |