#include "museum.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G) {
int N = B.size();
ll ans = 0;
for(int i = 1 ; i <(1<<3) ; i++){
map<array<int, 3 > , int> conta;
for(int j = 0 ; j < N ; j ++){
array<int, 3> X;
X[0] = 0 , X[1] = 0 , X[2] = 0;
if(1<<0 & i){
X[0] = B[j];
}
if(1<<1 & i){
X[1] = T[j];
}
if(1<<2 & i){
X[2] = G[j];
}
ans += conta[X] * ((__builtin_popcount(i) )%2 ? 1 : -1);
conta[X]++;
}
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
6 ms |
384 KB |
Output is correct |
3 |
Correct |
6 ms |
384 KB |
Output is correct |
4 |
Correct |
6 ms |
384 KB |
Output is correct |
5 |
Correct |
6 ms |
256 KB |
Output is correct |
6 |
Correct |
8 ms |
384 KB |
Output is correct |
7 |
Correct |
8 ms |
512 KB |
Output is correct |
8 |
Correct |
8 ms |
512 KB |
Output is correct |
9 |
Correct |
11 ms |
512 KB |
Output is correct |
10 |
Correct |
10 ms |
512 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
6 ms |
384 KB |
Output is correct |
3 |
Correct |
6 ms |
384 KB |
Output is correct |
4 |
Correct |
6 ms |
384 KB |
Output is correct |
5 |
Correct |
6 ms |
256 KB |
Output is correct |
6 |
Correct |
8 ms |
384 KB |
Output is correct |
7 |
Correct |
8 ms |
512 KB |
Output is correct |
8 |
Correct |
8 ms |
512 KB |
Output is correct |
9 |
Correct |
11 ms |
512 KB |
Output is correct |
10 |
Correct |
10 ms |
512 KB |
Output is correct |
11 |
Correct |
18 ms |
896 KB |
Output is correct |
12 |
Correct |
30 ms |
1072 KB |
Output is correct |
13 |
Correct |
151 ms |
4980 KB |
Output is correct |
14 |
Correct |
232 ms |
7144 KB |
Output is correct |
15 |
Correct |
338 ms |
10480 KB |
Output is correct |
16 |
Correct |
113 ms |
5224 KB |
Output is correct |
17 |
Correct |
237 ms |
5224 KB |
Output is correct |
18 |
Correct |
444 ms |
11368 KB |
Output is correct |
19 |
Correct |
534 ms |
16476 KB |
Output is correct |
20 |
Correct |
574 ms |
16492 KB |
Output is correct |