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 <bits/stdc++.h>
using namespace std;
int i,j,s,t;
int c[234567],a[234567],l=12345678,r,tt,k,y,z,n,m,x;
int minimumInstructions(int n, int m, int K, vector<int> C,vector<int> A, vector<vector<int>> B){
for (i = 0; i <m; i ++){
for (auto u:B[i]){
a[u]=i;
}
}
t= 0;
while (t<n){
x = a[C[t]];
k = 0;
for (i = t; i<n; i ++){
if (a[C[i]]!=(x+i-t)%m){
y=i;
break;
}
}
if (i==n){
if (n-t<m)
return -1;
s+=(n-t+m-1)/m;
break;
}
if (y-t<m)
return -1;
s+=(y-t+m-1)/m;
t=y;
}
return s;
}
# | 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... |