# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
409851 | 2021-05-21T16:36:38 Z | Ahmadsm2005 | Painting Walls (APIO20_paint) | C++14 | 2 ms | 2636 KB |
#include "paint.h" //#include "grader.cpp" #include <bits/stdc++.h> using namespace std; set<int>lolz[50001]; int minimumInstructions(int N,int M,int K,vector<int>C,vector<int>A,vector<vector<int>>B){ for(int i=0;i<B.size();i++){ for(int l=0;l<B[i].size();l++) lolz[i].insert(B[i][l]); } vector<int>P; int CUR=0,COST=0,LAST=-1; for(int i=0;i<N-M+1;i++){ if(LAST==-1){ for(int l=0;l<M;l++){ for(int x=l;x<M+l;x++){ if(lolz[x%M].find(C[x-l+i])==lolz[x%M].end()) goto a; } P.push_back(i); LAST=l; goto b; a:; } return -1; b:; continue; } /*LAST=(LAST+1)%M; for(int l=LAST;l<M+LAST;l++){ if(lolz[l%M].find(C[l-LAST+i])==lolz[l%M].end()) goto c; } P.push_back(i); continue; c:;*/ LAST=-1; } if(P[0]!=0) return -1; int MAXER=M; COST=1; for(int i=1;i<P.size();i++){ if(P[i]>MAXER){ if(MAXER==P[i-1]+M) return -1; MAXER=P[i-1]+M; COST++; i--; } } if(MAXER<N) COST++; return COST; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2636 KB | Output is correct |
2 | Correct | 2 ms | 2636 KB | Output is correct |
3 | Incorrect | 2 ms | 2636 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2636 KB | Output is correct |
2 | Correct | 2 ms | 2636 KB | Output is correct |
3 | Incorrect | 2 ms | 2636 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2636 KB | Output is correct |
2 | Correct | 2 ms | 2636 KB | Output is correct |
3 | Incorrect | 2 ms | 2636 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2636 KB | Output is correct |
2 | Correct | 2 ms | 2636 KB | Output is correct |
3 | Incorrect | 2 ms | 2636 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2636 KB | Output is correct |
2 | Correct | 2 ms | 2636 KB | Output is correct |
3 | Incorrect | 2 ms | 2636 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |