#include "museum.h"
int a[101],b[101],c[101],ab[101][101],bc[101][101],ac[101][101],abc[101][101][101];
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 += a[B[i]]+b[T[i]]+c[G[i]]-ab[B[i]][T[i]]-bc[T[i]][G[i]]-ac[B[i]][G[i]]+abc[B[i]][T[i]][G[i]];
a[B[i]]++;
b[T[i]]++;
c[G[i]]++;
ab[B[i]][T[i]]++;
bc[T[i]][G[i]]++;
ac[B[i]][G[i]]++;
abc[B[i]][T[i]][G[i]]++;
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
6 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 |
2048 KB |
Output is correct |
7 |
Correct |
8 ms |
2944 KB |
Output is correct |
8 |
Correct |
6 ms |
512 KB |
Output is correct |
9 |
Correct |
8 ms |
3840 KB |
Output is correct |
10 |
Correct |
8 ms |
3712 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
6 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 |
2048 KB |
Output is correct |
7 |
Correct |
8 ms |
2944 KB |
Output is correct |
8 |
Correct |
6 ms |
512 KB |
Output is correct |
9 |
Correct |
8 ms |
3840 KB |
Output is correct |
10 |
Correct |
8 ms |
3712 KB |
Output is correct |
11 |
Correct |
10 ms |
4652 KB |
Output is correct |
12 |
Correct |
16 ms |
1192 KB |
Output is correct |
13 |
Correct |
32 ms |
5368 KB |
Output is correct |
14 |
Correct |
45 ms |
6508 KB |
Output is correct |
15 |
Correct |
60 ms |
7308 KB |
Output is correct |
16 |
Correct |
79 ms |
5224 KB |
Output is correct |
17 |
Correct |
83 ms |
5388 KB |
Output is correct |
18 |
Correct |
86 ms |
6508 KB |
Output is correct |
19 |
Correct |
91 ms |
9324 KB |
Output is correct |
20 |
Correct |
96 ms |
9324 KB |
Output is correct |