# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
409847 | 2021-05-21T16:32:45 Z | Ahmadsm2005 | Painting Walls (APIO20_paint) | C++14 | 829 ms | 14896 KB |
#include "paint.h" //#include "grader.cpp" #include <bits/stdc++.h> using namespace std; set<int>lolz[2001]; 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; i+=M-2; } 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 | 1 ms | 332 KB | Output is correct |
2 | Correct | 1 ms | 332 KB | Output is correct |
3 | Correct | 1 ms | 332 KB | Output is correct |
4 | Correct | 1 ms | 388 KB | Output is correct |
5 | Correct | 1 ms | 332 KB | Output is correct |
6 | Correct | 1 ms | 332 KB | Output is correct |
7 | Correct | 1 ms | 332 KB | Output is correct |
8 | Correct | 2 ms | 332 KB | Output is correct |
9 | Correct | 1 ms | 332 KB | Output is correct |
10 | Correct | 1 ms | 332 KB | Output is correct |
11 | Correct | 1 ms | 332 KB | Output is correct |
12 | Correct | 1 ms | 332 KB | Output is correct |
13 | Correct | 2 ms | 332 KB | Output is correct |
14 | Correct | 2 ms | 396 KB | Output is correct |
15 | Correct | 2 ms | 332 KB | Output is correct |
16 | Correct | 1 ms | 332 KB | Output is correct |
17 | Correct | 1 ms | 392 KB | Output is correct |
18 | Correct | 2 ms | 332 KB | Output is correct |
19 | Correct | 1 ms | 460 KB | Output is correct |
20 | Correct | 1 ms | 400 KB | Output is correct |
21 | Correct | 1 ms | 392 KB | Output is correct |
22 | Correct | 25 ms | 6368 KB | Output is correct |
23 | Correct | 24 ms | 6360 KB | Output is correct |
24 | Correct | 25 ms | 6424 KB | Output is correct |
25 | Correct | 3 ms | 716 KB | Output is correct |
26 | Correct | 3 ms | 788 KB | Output is correct |
27 | Correct | 3 ms | 460 KB | Output is correct |
28 | Correct | 3 ms | 460 KB | Output is correct |
29 | Correct | 3 ms | 460 KB | Output is correct |
30 | Correct | 3 ms | 504 KB | Output is correct |
31 | Correct | 829 ms | 2132 KB | Output is correct |
32 | Correct | 822 ms | 2204 KB | Output is correct |
33 | Correct | 796 ms | 2204 KB | Output is correct |
34 | Correct | 814 ms | 2204 KB | Output is correct |
35 | Correct | 792 ms | 2228 KB | Output is correct |
36 | Correct | 804 ms | 2136 KB | Output is correct |
37 | Correct | 30 ms | 6852 KB | Output is correct |
38 | Correct | 26 ms | 6860 KB | Output is correct |
39 | Correct | 26 ms | 6884 KB | Output is correct |
40 | Correct | 16 ms | 1864 KB | Output is correct |
41 | Correct | 10 ms | 1244 KB | Output is correct |
42 | Correct | 10 ms | 1356 KB | Output is correct |
43 | Correct | 7 ms | 912 KB | Output is correct |
44 | Correct | 7 ms | 972 KB | Output is correct |
45 | Correct | 10 ms | 1300 KB | Output is correct |
46 | Runtime error | 60 ms | 14896 KB | Execution killed with signal 11 |
47 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 332 KB | Output is correct |
2 | Correct | 1 ms | 332 KB | Output is correct |
3 | Correct | 1 ms | 332 KB | Output is correct |
4 | Correct | 1 ms | 388 KB | Output is correct |
5 | Correct | 1 ms | 332 KB | Output is correct |
6 | Correct | 1 ms | 332 KB | Output is correct |
7 | Correct | 1 ms | 332 KB | Output is correct |
8 | Correct | 2 ms | 332 KB | Output is correct |
9 | Correct | 1 ms | 332 KB | Output is correct |
10 | Correct | 1 ms | 332 KB | Output is correct |
11 | Correct | 1 ms | 332 KB | Output is correct |
12 | Correct | 1 ms | 332 KB | Output is correct |
13 | Correct | 2 ms | 332 KB | Output is correct |
14 | Correct | 2 ms | 396 KB | Output is correct |
15 | Correct | 2 ms | 332 KB | Output is correct |
16 | Correct | 1 ms | 332 KB | Output is correct |
17 | Correct | 1 ms | 392 KB | Output is correct |
18 | Correct | 2 ms | 332 KB | Output is correct |
19 | Correct | 1 ms | 460 KB | Output is correct |
20 | Correct | 1 ms | 400 KB | Output is correct |
21 | Correct | 1 ms | 392 KB | Output is correct |
22 | Correct | 1 ms | 332 KB | Output is correct |
23 | Correct | 1 ms | 332 KB | Output is correct |
24 | Correct | 1 ms | 332 KB | Output is correct |
25 | Correct | 1 ms | 332 KB | Output is correct |
26 | Correct | 1 ms | 332 KB | Output is correct |
27 | Correct | 1 ms | 384 KB | Output is correct |
28 | Correct | 1 ms | 332 KB | Output is correct |
29 | Correct | 1 ms | 332 KB | Output is correct |
30 | Correct | 1 ms | 332 KB | Output is correct |
31 | Correct | 1 ms | 332 KB | Output is correct |
32 | Correct | 1 ms | 332 KB | Output is correct |
33 | Correct | 1 ms | 332 KB | Output is correct |
34 | Correct | 1 ms | 332 KB | Output is correct |
35 | Correct | 1 ms | 332 KB | Output is correct |
36 | Correct | 1 ms | 396 KB | Output is correct |
37 | Correct | 2 ms | 332 KB | Output is correct |
38 | Correct | 1 ms | 388 KB | Output is correct |
39 | Correct | 1 ms | 388 KB | Output is correct |
40 | Correct | 1 ms | 388 KB | Output is correct |
41 | Correct | 1 ms | 332 KB | Output is correct |
42 | Correct | 1 ms | 332 KB | Output is correct |
43 | Incorrect | 1 ms | 332 KB | Output isn't correct |
44 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 332 KB | Output is correct |
2 | Correct | 1 ms | 332 KB | Output is correct |
3 | Correct | 1 ms | 332 KB | Output is correct |
4 | Correct | 1 ms | 332 KB | Output is correct |
5 | Correct | 1 ms | 332 KB | Output is correct |
6 | Correct | 1 ms | 388 KB | Output is correct |
7 | Correct | 1 ms | 332 KB | Output is correct |
8 | Correct | 1 ms | 332 KB | Output is correct |
9 | Correct | 1 ms | 332 KB | Output is correct |
10 | Correct | 2 ms | 332 KB | Output is correct |
11 | Correct | 1 ms | 332 KB | Output is correct |
12 | Correct | 1 ms | 332 KB | Output is correct |
13 | Correct | 1 ms | 332 KB | Output is correct |
14 | Correct | 1 ms | 332 KB | Output is correct |
15 | Correct | 2 ms | 332 KB | Output is correct |
16 | Correct | 2 ms | 396 KB | Output is correct |
17 | Correct | 2 ms | 332 KB | Output is correct |
18 | Correct | 1 ms | 332 KB | Output is correct |
19 | Correct | 1 ms | 392 KB | Output is correct |
20 | Correct | 2 ms | 332 KB | Output is correct |
21 | Correct | 1 ms | 460 KB | Output is correct |
22 | Correct | 1 ms | 400 KB | Output is correct |
23 | Correct | 1 ms | 392 KB | Output is correct |
24 | Correct | 25 ms | 6368 KB | Output is correct |
25 | Correct | 24 ms | 6360 KB | Output is correct |
26 | Correct | 25 ms | 6424 KB | Output is correct |
27 | Correct | 1 ms | 332 KB | Output is correct |
28 | Correct | 1 ms | 332 KB | Output is correct |
29 | Correct | 1 ms | 332 KB | Output is correct |
30 | Correct | 1 ms | 384 KB | Output is correct |
31 | Correct | 1 ms | 332 KB | Output is correct |
32 | Correct | 1 ms | 332 KB | Output is correct |
33 | Correct | 1 ms | 332 KB | Output is correct |
34 | Correct | 1 ms | 332 KB | Output is correct |
35 | Correct | 1 ms | 332 KB | Output is correct |
36 | Correct | 1 ms | 332 KB | Output is correct |
37 | Correct | 1 ms | 332 KB | Output is correct |
38 | Correct | 1 ms | 332 KB | Output is correct |
39 | Correct | 1 ms | 396 KB | Output is correct |
40 | Correct | 2 ms | 332 KB | Output is correct |
41 | Correct | 1 ms | 388 KB | Output is correct |
42 | Correct | 1 ms | 388 KB | Output is correct |
43 | Correct | 1 ms | 388 KB | Output is correct |
44 | Correct | 1 ms | 332 KB | Output is correct |
45 | Correct | 1 ms | 332 KB | Output is correct |
46 | Incorrect | 1 ms | 332 KB | Output isn't correct |
47 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 332 KB | Output is correct |
2 | Correct | 1 ms | 332 KB | Output is correct |
3 | Correct | 1 ms | 332 KB | Output is correct |
4 | Correct | 1 ms | 332 KB | Output is correct |
5 | Correct | 1 ms | 332 KB | Output is correct |
6 | Correct | 1 ms | 388 KB | Output is correct |
7 | Correct | 1 ms | 332 KB | Output is correct |
8 | Correct | 1 ms | 332 KB | Output is correct |
9 | Correct | 1 ms | 332 KB | Output is correct |
10 | Correct | 2 ms | 332 KB | Output is correct |
11 | Correct | 1 ms | 332 KB | Output is correct |
12 | Correct | 1 ms | 332 KB | Output is correct |
13 | Correct | 1 ms | 332 KB | Output is correct |
14 | Correct | 1 ms | 332 KB | Output is correct |
15 | Correct | 2 ms | 332 KB | Output is correct |
16 | Correct | 2 ms | 396 KB | Output is correct |
17 | Correct | 2 ms | 332 KB | Output is correct |
18 | Correct | 1 ms | 332 KB | Output is correct |
19 | Correct | 1 ms | 392 KB | Output is correct |
20 | Correct | 2 ms | 332 KB | Output is correct |
21 | Correct | 1 ms | 460 KB | Output is correct |
22 | Correct | 1 ms | 400 KB | Output is correct |
23 | Correct | 1 ms | 392 KB | Output is correct |
24 | Correct | 25 ms | 6368 KB | Output is correct |
25 | Correct | 24 ms | 6360 KB | Output is correct |
26 | Correct | 25 ms | 6424 KB | Output is correct |
27 | Correct | 3 ms | 716 KB | Output is correct |
28 | Correct | 3 ms | 788 KB | Output is correct |
29 | Correct | 3 ms | 460 KB | Output is correct |
30 | Correct | 3 ms | 460 KB | Output is correct |
31 | Correct | 3 ms | 460 KB | Output is correct |
32 | Correct | 3 ms | 504 KB | Output is correct |
33 | Correct | 829 ms | 2132 KB | Output is correct |
34 | Correct | 822 ms | 2204 KB | Output is correct |
35 | Correct | 796 ms | 2204 KB | Output is correct |
36 | Correct | 814 ms | 2204 KB | Output is correct |
37 | Correct | 792 ms | 2228 KB | Output is correct |
38 | Correct | 804 ms | 2136 KB | Output is correct |
39 | Correct | 30 ms | 6852 KB | Output is correct |
40 | Correct | 26 ms | 6860 KB | Output is correct |
41 | Correct | 26 ms | 6884 KB | Output is correct |
42 | Correct | 1 ms | 332 KB | Output is correct |
43 | Correct | 1 ms | 332 KB | Output is correct |
44 | Correct | 1 ms | 332 KB | Output is correct |
45 | Correct | 1 ms | 384 KB | Output is correct |
46 | Correct | 1 ms | 332 KB | Output is correct |
47 | Correct | 1 ms | 332 KB | Output is correct |
48 | Correct | 1 ms | 332 KB | Output is correct |
49 | Correct | 1 ms | 332 KB | Output is correct |
50 | Correct | 1 ms | 332 KB | Output is correct |
51 | Correct | 1 ms | 332 KB | Output is correct |
52 | Correct | 1 ms | 332 KB | Output is correct |
53 | Correct | 1 ms | 332 KB | Output is correct |
54 | Correct | 1 ms | 396 KB | Output is correct |
55 | Correct | 2 ms | 332 KB | Output is correct |
56 | Correct | 1 ms | 388 KB | Output is correct |
57 | Correct | 1 ms | 388 KB | Output is correct |
58 | Correct | 1 ms | 388 KB | Output is correct |
59 | Correct | 1 ms | 332 KB | Output is correct |
60 | Correct | 1 ms | 332 KB | Output is correct |
61 | Incorrect | 1 ms | 332 KB | Output isn't correct |
62 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 332 KB | Output is correct |
2 | Correct | 1 ms | 332 KB | Output is correct |
3 | Correct | 1 ms | 332 KB | Output is correct |
4 | Correct | 1 ms | 332 KB | Output is correct |
5 | Correct | 1 ms | 332 KB | Output is correct |
6 | Correct | 1 ms | 388 KB | Output is correct |
7 | Correct | 1 ms | 332 KB | Output is correct |
8 | Correct | 1 ms | 332 KB | Output is correct |
9 | Correct | 1 ms | 332 KB | Output is correct |
10 | Correct | 2 ms | 332 KB | Output is correct |
11 | Correct | 1 ms | 332 KB | Output is correct |
12 | Correct | 1 ms | 332 KB | Output is correct |
13 | Correct | 1 ms | 332 KB | Output is correct |
14 | Correct | 1 ms | 332 KB | Output is correct |
15 | Correct | 2 ms | 332 KB | Output is correct |
16 | Correct | 2 ms | 396 KB | Output is correct |
17 | Correct | 2 ms | 332 KB | Output is correct |
18 | Correct | 1 ms | 332 KB | Output is correct |
19 | Correct | 1 ms | 392 KB | Output is correct |
20 | Correct | 2 ms | 332 KB | Output is correct |
21 | Correct | 1 ms | 460 KB | Output is correct |
22 | Correct | 1 ms | 400 KB | Output is correct |
23 | Correct | 1 ms | 392 KB | Output is correct |
24 | Correct | 25 ms | 6368 KB | Output is correct |
25 | Correct | 24 ms | 6360 KB | Output is correct |
26 | Correct | 25 ms | 6424 KB | Output is correct |
27 | Correct | 3 ms | 716 KB | Output is correct |
28 | Correct | 3 ms | 788 KB | Output is correct |
29 | Correct | 3 ms | 460 KB | Output is correct |
30 | Correct | 3 ms | 460 KB | Output is correct |
31 | Correct | 3 ms | 460 KB | Output is correct |
32 | Correct | 3 ms | 504 KB | Output is correct |
33 | Correct | 829 ms | 2132 KB | Output is correct |
34 | Correct | 822 ms | 2204 KB | Output is correct |
35 | Correct | 796 ms | 2204 KB | Output is correct |
36 | Correct | 814 ms | 2204 KB | Output is correct |
37 | Correct | 792 ms | 2228 KB | Output is correct |
38 | Correct | 804 ms | 2136 KB | Output is correct |
39 | Correct | 30 ms | 6852 KB | Output is correct |
40 | Correct | 26 ms | 6860 KB | Output is correct |
41 | Correct | 26 ms | 6884 KB | Output is correct |
42 | Correct | 16 ms | 1864 KB | Output is correct |
43 | Correct | 10 ms | 1244 KB | Output is correct |
44 | Correct | 10 ms | 1356 KB | Output is correct |
45 | Correct | 7 ms | 912 KB | Output is correct |
46 | Correct | 7 ms | 972 KB | Output is correct |
47 | Correct | 10 ms | 1300 KB | Output is correct |
48 | Runtime error | 60 ms | 14896 KB | Execution killed with signal 11 |
49 | Halted | 0 ms | 0 KB | - |