#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) {
set<int> allowed;
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)allowed.insert(j-M+1);
}
}
int lim=0;
int ans=0;
while(lim<N){
auto it=allowed.upper_bound(lim);
if(it==allowed.begin())return -1;
--it;
lim=*it+M;
allowed.erase(it);
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... |