#include "paint.h"
#include<bits/stdc++.h>
#include <vector>
bool is[205][100005];
int minimumInstructions(
int N, int M, int K, std::vector<int> C,
std::vector<int> A, std::vector<std::vector<int>> B) {
bool ps[505];
memset(ps, 0, sizeof(ps));
memset(is, 0, sizeof(is));
for (int i=0;i<M;i++)for (int j=0;j<A[i];j++)is[i][B[i][j]]=1;
for (int i=0;i<N-M;i++){
for (int j=0;j<M;j++){
if (ps[i])break;
if (is[j][C[i]]){
bool x=0;
for (int l=0;l<M;l++){
if (!is[(j+l)%M][C[i+l]]){
x=1;
break;
}
}
if (!x)ps[i]=1;
}
}
}
int res=1, t=N-M;
if (!ps[t])return -1;
while(t!=0){
bool q=0;
for (int i=t-M;i<t;i++){
if (ps[i]){
t=i;
q=1;
res++;
break;
}
}
if (!q)return -1;
}
return res;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
10 ms |
20300 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
10 ms |
20300 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
10 ms |
20300 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
10 ms |
20300 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
10 ms |
20300 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |