Submission #403632

#TimeUsernameProblemLanguageResultExecution timeMemory
403632Waratpp123벽 칠하기 (APIO20_paint)C++14
0 / 100
2 ms3020 KiB
#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 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...