#include "paint.h"
#include <vector>
#include <iostream>
#include <set>
#include <map>
#include <cmath>
using namespace std;
const int maxn = 1e6 + 200, maxm = 1e3 + 200, inf = 1e9;
int n, m, k;
int cnt[maxn];
int minimumInstructions(int N, int M, int K, vector<int> C, vector<int> A, vector<vector<int>> B) {
n = N, m = M, k = K;
for (int i = 0; i < k; ++i){
cnt[i] = -1;
}
for (int i = 0; i < m; ++i){
for (auto it : B[i]){
cnt[it] = i;
}
}
for (int i = 0; i < n; i += m){
int x = cnt[C[i]];
if (x == -1){
return -1;
}
int y = 0;
while (y < m){
int ok = 0;
for (auto it : B[x]){
if (it == C[y + i]){
ok = 1;
break;
}
}
if (ok == 0){
return -1;
}
x = (x + 1) % m;
}
}
return (n + m - 1) / m;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |