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;
pair<int,pair<int,int>>p[234567];
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;
}
}
s= 0;
if (n%m==0){
while (s<n){
x = a[C[s]];
for (i = s; i<s+m; i ++){
if (a[C[i]]!=(x+i-s)%m)
return -1;
}
s+=m;
}
return n/m;
}
else {
x = a[C[0]];
for (i = 0; i <n; i ++){
if (a[C[i]]!=(x+i)%m)
return -1;
}
return n/m+1;
}
}
# | 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... |