#include <bits/stdc++.h>
#include "museum.h"
//~ #include "grader.cpp"
using namespace std;
#define ll long long
int cnt1[3][101], cnt2[3][101][101], cnt3[101][101][101];
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 = n - 1 ; i >= 0 ; i--){
int cur = 0;
cur += cnt1[0][B[i]];
cur += cnt1[1][T[i]];
cur += cnt1[2][G[i]];
cur -= cnt2[0][B[i]][T[i]];
cur -= cnt2[1][B[i]][G[i]];
cur -= cnt2[2][T[i]][G[i]];
cur += cnt3[B[i]][T[i]][G[i]];
ans += cur;
cnt1[0][B[i]]++;
cnt1[1][T[i]]++;
cnt1[2][G[i]]++;
cnt2[0][B[i]][T[i]]++;
cnt2[1][B[i]][G[i]]++;
cnt2[2][T[i]][G[i]]++;
cnt3[B[i]][T[i]][G[i]]++;
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
6 ms |
512 KB |
Output is correct |
4 |
Correct |
5 ms |
640 KB |
Output is correct |
5 |
Correct |
7 ms |
1792 KB |
Output is correct |
6 |
Correct |
7 ms |
2048 KB |
Output is correct |
7 |
Correct |
8 ms |
2944 KB |
Output is correct |
8 |
Correct |
7 ms |
512 KB |
Output is correct |
9 |
Correct |
9 ms |
4096 KB |
Output is correct |
10 |
Correct |
8 ms |
3712 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
6 ms |
512 KB |
Output is correct |
4 |
Correct |
5 ms |
640 KB |
Output is correct |
5 |
Correct |
7 ms |
1792 KB |
Output is correct |
6 |
Correct |
7 ms |
2048 KB |
Output is correct |
7 |
Correct |
8 ms |
2944 KB |
Output is correct |
8 |
Correct |
7 ms |
512 KB |
Output is correct |
9 |
Correct |
9 ms |
4096 KB |
Output is correct |
10 |
Correct |
8 ms |
3712 KB |
Output is correct |
11 |
Correct |
10 ms |
4480 KB |
Output is correct |
12 |
Correct |
19 ms |
1152 KB |
Output is correct |
13 |
Correct |
34 ms |
5500 KB |
Output is correct |
14 |
Correct |
47 ms |
6512 KB |
Output is correct |
15 |
Correct |
62 ms |
7536 KB |
Output is correct |
16 |
Correct |
84 ms |
5224 KB |
Output is correct |
17 |
Correct |
88 ms |
5352 KB |
Output is correct |
18 |
Correct |
91 ms |
6424 KB |
Output is correct |
19 |
Correct |
101 ms |
9324 KB |
Output is correct |
20 |
Correct |
100 ms |
9324 KB |
Output is correct |