Submission #395561

#TimeUsernameProblemLanguageResultExecution timeMemory
395561SugardorjPainting Walls (APIO20_paint)C++14
0 / 100
1 ms204 KiB
#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){ k = 1; y=i; } } 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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...