This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "paint.h"
#include <vector>
#include<bits/stdc++.h>
using namespace std;
unordered_map<int,int> mp[50010];
int mark[50010];
int minimumInstructions(
int n, int m, int K, std::vector<int> C,
std::vector<int> A, std::vector<std::vector<int>> B) {
int i,j,cnt=0,k,ch,err;
for(i=0;i<m;i++){
for(auto x : B[i]){
mp[i][x]=1;
}
}
for(i=0;i<n-m;i++){
ch=0;
for(j=0;j<m;j++){
err=0;
for(k=0;k<m;k++){
if(mp[(j+k)%m][C[i+k]]==0){
err=1;
break;
}
}
if(err==0){
ch=1;
break;
}
}
mark[i]=ch;
}
i=0;
cnt=0;
while(i<n){
cnt++;
if(mark[i]==1){
i+=m;
}else i--;
if(cnt==n) break;
}
if(cnt==n) return -1;
return cnt;
}
# | 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... |