#include "paint.h"
#pragma GCC optimize "O3,unroll-loops"
#pragma GCC target "abm,bmi,bmi2,popcnt,lzcnt,avx,avx2"
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define all(v) begin(v), end(v)
#define REP(i,o,n) for(int i=o;i<n;i++)
using namespace std;
int minimumInstructions(
int N, int M, int K, std::vector<int> C,
std::vector<int> A, std::vector<std::vector<int>> B) {
vector<bool> possible(N+20);
REP(i,0,M){
int streak=0;
int x=i;
REP(j,0,N){
if(binary_search(all(B[x]),C[j]))streak++;
else streak=0;
x++;
if(x==M)x=0;
if(streak >= M)possible[j-M+1]=true;
}
}
int lim=0;
int nli=-1;
int ans=0;
REP(i,0,N){
if(possible[i])nli=i+M;
if(i==lim){
if(nli <= lim)return -1;
lim=nli;
ans++;
}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |