제출 #386320

#제출 시각아이디문제언어결과실행 시간메모리
386320leinad2벽 칠하기 (APIO20_paint)C++17
0 / 100
1574 ms364 KiB
#include<bits/stdc++.h> using namespace std; int minimumInstructions(int N, int M, int K, vector<int>C, vector<int>A, vector<vector<int> >B) { int i, j, k; vector<vector<int> >chk; vector<int>X; chk.resize(M);X.resize(N); for(i=0;i<M;i++)chk[i].resize(K); for(i=0;i<M;i++) { for(j=0;j<A[i];j++) { chk[i][B[i][j]]=1; } } for(i=0;i<M;i++) { for(j=0;j<=N-M;j++) { int a=0; for(k=0;k<M;k++) { a+=chk[(i+k)%M][C[j+k]]; } if(a==M)X[j]=1; } } i=0; if(X[0]==0||X[N-M]==0)return -1; int ans=0; while(1) { if(i==N-M)return ans+1; k=-1; for(j=i;j<=i+M;j++) { if(X[j])k=j; } if(k==-1)return -1; i=k;ans++; } }
#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...