#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(), 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 |
6 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
6 ms |
536 KB |
Output is correct |
4 |
Correct |
6 ms |
768 KB |
Output is correct |
5 |
Correct |
7 ms |
1792 KB |
Output is correct |
6 |
Correct |
7 ms |
2176 KB |
Output is correct |
7 |
Correct |
8 ms |
2944 KB |
Output is correct |
8 |
Correct |
6 ms |
384 KB |
Output is correct |
9 |
Correct |
9 ms |
3968 KB |
Output is correct |
10 |
Correct |
9 ms |
3968 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
6 ms |
536 KB |
Output is correct |
4 |
Correct |
6 ms |
768 KB |
Output is correct |
5 |
Correct |
7 ms |
1792 KB |
Output is correct |
6 |
Correct |
7 ms |
2176 KB |
Output is correct |
7 |
Correct |
8 ms |
2944 KB |
Output is correct |
8 |
Correct |
6 ms |
384 KB |
Output is correct |
9 |
Correct |
9 ms |
3968 KB |
Output is correct |
10 |
Correct |
9 ms |
3968 KB |
Output is correct |
11 |
Correct |
11 ms |
4608 KB |
Output is correct |
12 |
Correct |
17 ms |
1144 KB |
Output is correct |
13 |
Correct |
33 ms |
5628 KB |
Output is correct |
14 |
Correct |
45 ms |
6532 KB |
Output is correct |
15 |
Correct |
59 ms |
7536 KB |
Output is correct |
16 |
Incorrect |
78 ms |
5220 KB |
Output isn't correct |
17 |
Halted |
0 ms |
0 KB |
- |