#include "paint.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long un;
typedef vector<un> vuc;
typedef vector<bool> vol;
#define vec vector
#define REP(i, a, b) for (un i = (un)a; i < (un)b; i++)
#define FEAC(i, a) for (auto&& i : a)
constexpr un INF = 1e9;
int minimumInstructions(int N, int M, int K, std::vector<int> C, std::vector<int> A, std::vector<std::vector<int>> B) {
vuc tab(K, -1);
REP(m, 0, M) {
FEAC(col, B[m]) tab[col] = m;
}
un ret = 0;
un x = 0;
while (x < N)
{
un nejkdy = 0;
REP(y, 0, M){
bool bad = false;
bool skoc = false;
un kdy = M;
REP(l, 0, M){
if ((x+l - skoc*M < 0) or (x+l - skoc*M >= N) or (tab[C[x+l - skoc*M]] == (y+l)%M)){
if (not skoc) {
kdy = l;
l--;
skoc = true;
}
else{
bad = true;
break;
}
}
}
if(not bad){
nejkdy = max(nejkdy, kdy);
}
}
if (nejkdy == 0){
return -1;
}
x += nejkdy;
ret++;
}
return ret;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |