#include "museum.h"
using namespace std;
int Bs[111], Ts[111], Gs[111], BT[111][111], TG[111][111], BG[111][111], BTG[111][111][111];
long long sum;
long long CountSimilarPairs(vector<int> B, vector<int> T, vector<int> G) {
int N=B.size();
for(int i=0; i<N; i++){
sum += Bs[B[i]]+Ts[T[i]]+Gs[G[i]];
Bs[B[i]]++, Ts[T[i]]++, Gs[G[i]]++;
sum -= BT[B[i]][T[i]]+TG[T[i]][G[i]]+BG[B[i]][G[i]];
BT[B[i]][T[i]]++, TG[T[i]][G[i]]++, BG[B[i]][G[i]]++;
sum += BTG[B[i]][T[i]][G[i]];
BTG[B[i]][T[i]][G[i]]++;
}
return sum;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
3 ms |
636 KB |
Output is correct |
5 |
Correct |
4 ms |
1784 KB |
Output is correct |
6 |
Correct |
5 ms |
2296 KB |
Output is correct |
7 |
Correct |
6 ms |
3196 KB |
Output is correct |
8 |
Correct |
3 ms |
504 KB |
Output is correct |
9 |
Correct |
7 ms |
4344 KB |
Output is correct |
10 |
Correct |
8 ms |
4216 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
3 ms |
636 KB |
Output is correct |
5 |
Correct |
4 ms |
1784 KB |
Output is correct |
6 |
Correct |
5 ms |
2296 KB |
Output is correct |
7 |
Correct |
6 ms |
3196 KB |
Output is correct |
8 |
Correct |
3 ms |
504 KB |
Output is correct |
9 |
Correct |
7 ms |
4344 KB |
Output is correct |
10 |
Correct |
8 ms |
4216 KB |
Output is correct |
11 |
Correct |
9 ms |
5240 KB |
Output is correct |
12 |
Correct |
12 ms |
1272 KB |
Output is correct |
13 |
Correct |
28 ms |
6312 KB |
Output is correct |
14 |
Correct |
39 ms |
7964 KB |
Output is correct |
15 |
Correct |
54 ms |
9300 KB |
Output is correct |
16 |
Correct |
71 ms |
6400 KB |
Output is correct |
17 |
Correct |
71 ms |
6500 KB |
Output is correct |
18 |
Correct |
76 ms |
8172 KB |
Output is correct |
19 |
Correct |
86 ms |
11912 KB |
Output is correct |
20 |
Correct |
85 ms |
11888 KB |
Output is correct |