Submission #292757

# Submission time Handle Problem Language Result Execution time Memory
292757 2020-09-07T12:55:11 Z daniel920712 Painting Walls (APIO20_paint) C++14
28 / 100
1500 ms 179880 KB
#include "paint.h"

#include <vector>
#include <stdio.h>
using namespace std;
bool can[2005][100005]={0};
bool have[200005]={0};
int DP[200005];
vector < int > all;
vector < int > how[200005];
int N,M;
int F(int here)
{
    int ok=0,ok2,i,j;
    if(have[here]) return DP[here];
    if(here==N) return 0;
    have[here]=1;
    if(here+M>N)
    {
        DP[here]=1e9;
        return 1e9;
    }
    for(auto i:how[all[here]])
    {
        ok2=1;
        for(j=0;j<M;j++)
        {
            if(can[(i+j)%M][all[here+j]]==0)
            {
                ok2=0;
                break;
            }
        }
        if(ok2) ok=1;
    }
    DP[here]=1e9;
    if(ok)
    {
        for(i=1;i<=M;i++)
        {
            DP[here]=min(DP[here],F(here+i)+1);
            //printf("%d %d %d\n",here,i,F(here+i)+1);
        }
    }
    return DP[here];
}
int minimumInstructions(int N, int M, int K, vector<int> C, vector<int> A,vector< vector<int> > B)
{
    int i,j;
    all=C;
    ::N=N;
    ::M=M;
    for(i=0;i<M;i++)
    {
        for(j=0;j<A[i];j++)
        {
            can[i][B[i][j]]=1;
            how[B[i][j]].push_back(i);
        }
    }
    int t=F(0);
    if(t>=1000000000) return -1;
    return t;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4992 KB Output is correct
2 Correct 3 ms 4992 KB Output is correct
3 Correct 3 ms 4992 KB Output is correct
4 Correct 4 ms 5024 KB Output is correct
5 Correct 3 ms 4992 KB Output is correct
6 Correct 4 ms 4992 KB Output is correct
7 Correct 3 ms 4992 KB Output is correct
8 Correct 4 ms 4992 KB Output is correct
9 Correct 3 ms 4992 KB Output is correct
10 Correct 3 ms 4992 KB Output is correct
11 Correct 3 ms 4992 KB Output is correct
12 Correct 4 ms 4992 KB Output is correct
13 Correct 5 ms 7040 KB Output is correct
14 Correct 6 ms 7040 KB Output is correct
15 Correct 5 ms 7040 KB Output is correct
16 Correct 5 ms 7040 KB Output is correct
17 Correct 6 ms 7040 KB Output is correct
18 Correct 5 ms 7040 KB Output is correct
19 Correct 6 ms 8704 KB Output is correct
20 Correct 6 ms 8736 KB Output is correct
21 Correct 6 ms 8704 KB Output is correct
22 Correct 43 ms 28544 KB Output is correct
23 Correct 47 ms 28536 KB Output is correct
24 Correct 54 ms 28536 KB Output is correct
25 Correct 6 ms 6272 KB Output is correct
26 Correct 7 ms 6272 KB Output is correct
27 Correct 6 ms 5248 KB Output is correct
28 Correct 6 ms 5248 KB Output is correct
29 Correct 6 ms 5248 KB Output is correct
30 Correct 6 ms 5248 KB Output is correct
31 Correct 676 ms 74752 KB Output is correct
32 Correct 683 ms 74760 KB Output is correct
33 Correct 677 ms 74232 KB Output is correct
34 Correct 690 ms 74416 KB Output is correct
35 Correct 691 ms 74356 KB Output is correct
36 Correct 687 ms 74620 KB Output is correct
37 Correct 127 ms 179448 KB Output is correct
38 Correct 124 ms 179880 KB Output is correct
39 Correct 127 ms 179448 KB Output is correct
40 Correct 18 ms 10752 KB Output is correct
41 Correct 12 ms 8576 KB Output is correct
42 Correct 14 ms 6272 KB Output is correct
43 Correct 11 ms 5760 KB Output is correct
44 Correct 10 ms 5760 KB Output is correct
45 Correct 14 ms 6144 KB Output is correct
46 Runtime error 129 ms 56488 KB Execution killed with signal 11
47 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 4992 KB Output is correct
2 Correct 4 ms 4992 KB Output is correct
3 Correct 3 ms 4992 KB Output is correct
4 Correct 3 ms 4992 KB Output is correct
5 Correct 3 ms 4992 KB Output is correct
6 Correct 4 ms 5024 KB Output is correct
7 Correct 3 ms 4992 KB Output is correct
8 Correct 4 ms 4992 KB Output is correct
9 Correct 3 ms 4992 KB Output is correct
10 Correct 4 ms 4992 KB Output is correct
11 Correct 3 ms 4992 KB Output is correct
12 Correct 3 ms 4992 KB Output is correct
13 Correct 3 ms 4992 KB Output is correct
14 Correct 4 ms 4992 KB Output is correct
15 Correct 5 ms 7040 KB Output is correct
16 Correct 6 ms 7040 KB Output is correct
17 Correct 5 ms 7040 KB Output is correct
18 Correct 5 ms 7040 KB Output is correct
19 Correct 6 ms 7040 KB Output is correct
20 Correct 5 ms 7040 KB Output is correct
21 Correct 6 ms 8704 KB Output is correct
22 Correct 6 ms 8736 KB Output is correct
23 Correct 6 ms 8704 KB Output is correct
24 Correct 3 ms 4992 KB Output is correct
25 Correct 3 ms 4992 KB Output is correct
26 Correct 3 ms 4992 KB Output is correct
27 Correct 3 ms 4992 KB Output is correct
28 Correct 5 ms 5120 KB Output is correct
29 Correct 4 ms 5120 KB Output is correct
30 Correct 4 ms 5120 KB Output is correct
31 Correct 3 ms 5120 KB Output is correct
32 Correct 4 ms 5248 KB Output is correct
33 Correct 5 ms 6656 KB Output is correct
34 Correct 5 ms 6784 KB Output is correct
35 Correct 4 ms 6144 KB Output is correct
36 Correct 5 ms 6528 KB Output is correct
37 Correct 4 ms 6400 KB Output is correct
38 Correct 4 ms 5376 KB Output is correct
39 Correct 4 ms 4992 KB Output is correct
40 Correct 5 ms 8320 KB Output is correct
41 Correct 4 ms 5760 KB Output is correct
42 Correct 5 ms 7424 KB Output is correct
43 Correct 5 ms 6528 KB Output is correct
44 Correct 3 ms 4992 KB Output is correct
45 Correct 7 ms 5120 KB Output is correct
46 Correct 4 ms 5248 KB Output is correct
47 Correct 4 ms 5376 KB Output is correct
48 Correct 4 ms 5248 KB Output is correct
49 Correct 5 ms 5248 KB Output is correct
50 Correct 5 ms 7040 KB Output is correct
51 Correct 6 ms 7040 KB Output is correct
52 Correct 5 ms 7040 KB Output is correct
53 Correct 5 ms 7040 KB Output is correct
54 Correct 6 ms 7072 KB Output is correct
55 Correct 5 ms 7040 KB Output is correct
56 Correct 6 ms 8704 KB Output is correct
57 Correct 5 ms 5888 KB Output is correct
58 Correct 6 ms 8704 KB Output is correct
59 Correct 5 ms 5888 KB Output is correct
60 Correct 6 ms 8704 KB Output is correct
61 Correct 5 ms 5888 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 4992 KB Output is correct
2 Correct 4 ms 4992 KB Output is correct
3 Correct 3 ms 4992 KB Output is correct
4 Correct 3 ms 4992 KB Output is correct
5 Correct 3 ms 4992 KB Output is correct
6 Correct 4 ms 5024 KB Output is correct
7 Correct 3 ms 4992 KB Output is correct
8 Correct 4 ms 4992 KB Output is correct
9 Correct 3 ms 4992 KB Output is correct
10 Correct 4 ms 4992 KB Output is correct
11 Correct 3 ms 4992 KB Output is correct
12 Correct 3 ms 4992 KB Output is correct
13 Correct 3 ms 4992 KB Output is correct
14 Correct 4 ms 4992 KB Output is correct
15 Correct 5 ms 7040 KB Output is correct
16 Correct 6 ms 7040 KB Output is correct
17 Correct 5 ms 7040 KB Output is correct
18 Correct 5 ms 7040 KB Output is correct
19 Correct 6 ms 7040 KB Output is correct
20 Correct 5 ms 7040 KB Output is correct
21 Correct 6 ms 8704 KB Output is correct
22 Correct 6 ms 8736 KB Output is correct
23 Correct 6 ms 8704 KB Output is correct
24 Correct 43 ms 28544 KB Output is correct
25 Correct 47 ms 28536 KB Output is correct
26 Correct 54 ms 28536 KB Output is correct
27 Correct 3 ms 4992 KB Output is correct
28 Correct 3 ms 4992 KB Output is correct
29 Correct 3 ms 4992 KB Output is correct
30 Correct 3 ms 4992 KB Output is correct
31 Correct 5 ms 5120 KB Output is correct
32 Correct 4 ms 5120 KB Output is correct
33 Correct 4 ms 5120 KB Output is correct
34 Correct 3 ms 5120 KB Output is correct
35 Correct 4 ms 5248 KB Output is correct
36 Correct 5 ms 6656 KB Output is correct
37 Correct 5 ms 6784 KB Output is correct
38 Correct 4 ms 6144 KB Output is correct
39 Correct 5 ms 6528 KB Output is correct
40 Correct 4 ms 6400 KB Output is correct
41 Correct 4 ms 5376 KB Output is correct
42 Correct 4 ms 4992 KB Output is correct
43 Correct 5 ms 8320 KB Output is correct
44 Correct 4 ms 5760 KB Output is correct
45 Correct 5 ms 7424 KB Output is correct
46 Correct 5 ms 6528 KB Output is correct
47 Correct 3 ms 4992 KB Output is correct
48 Correct 7 ms 5120 KB Output is correct
49 Correct 4 ms 5248 KB Output is correct
50 Correct 4 ms 5376 KB Output is correct
51 Correct 4 ms 5248 KB Output is correct
52 Correct 5 ms 5248 KB Output is correct
53 Correct 5 ms 7040 KB Output is correct
54 Correct 6 ms 7040 KB Output is correct
55 Correct 5 ms 7040 KB Output is correct
56 Correct 5 ms 7040 KB Output is correct
57 Correct 6 ms 7072 KB Output is correct
58 Correct 5 ms 7040 KB Output is correct
59 Correct 6 ms 8704 KB Output is correct
60 Correct 5 ms 5888 KB Output is correct
61 Correct 6 ms 8704 KB Output is correct
62 Correct 5 ms 5888 KB Output is correct
63 Correct 6 ms 8704 KB Output is correct
64 Correct 5 ms 5888 KB Output is correct
65 Correct 16 ms 5760 KB Output is correct
66 Correct 7 ms 5248 KB Output is correct
67 Correct 34 ms 5504 KB Output is correct
68 Correct 15 ms 5376 KB Output is correct
69 Correct 31 ms 5504 KB Output is correct
70 Correct 20 ms 19840 KB Output is correct
71 Correct 17 ms 15872 KB Output is correct
72 Correct 13 ms 9984 KB Output is correct
73 Correct 6 ms 6272 KB Output is correct
74 Correct 14 ms 13696 KB Output is correct
75 Correct 19 ms 20480 KB Output is correct
76 Correct 36 ms 15940 KB Output is correct
77 Correct 27 ms 8312 KB Output is correct
78 Correct 42 ms 11768 KB Output is correct
79 Correct 68 ms 5940 KB Output is correct
80 Correct 68 ms 5888 KB Output is correct
81 Correct 70 ms 6008 KB Output is correct
82 Correct 68 ms 5888 KB Output is correct
83 Correct 69 ms 5888 KB Output is correct
84 Correct 29 ms 23808 KB Output is correct
85 Correct 28 ms 23808 KB Output is correct
86 Correct 28 ms 23808 KB Output is correct
87 Correct 28 ms 24064 KB Output is correct
88 Correct 28 ms 23808 KB Output is correct
89 Correct 27 ms 23552 KB Output is correct
90 Correct 62 ms 28280 KB Output is correct
91 Correct 60 ms 28360 KB Output is correct
92 Correct 61 ms 28280 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 4992 KB Output is correct
2 Correct 4 ms 4992 KB Output is correct
3 Correct 3 ms 4992 KB Output is correct
4 Correct 3 ms 4992 KB Output is correct
5 Correct 3 ms 4992 KB Output is correct
6 Correct 4 ms 5024 KB Output is correct
7 Correct 3 ms 4992 KB Output is correct
8 Correct 4 ms 4992 KB Output is correct
9 Correct 3 ms 4992 KB Output is correct
10 Correct 4 ms 4992 KB Output is correct
11 Correct 3 ms 4992 KB Output is correct
12 Correct 3 ms 4992 KB Output is correct
13 Correct 3 ms 4992 KB Output is correct
14 Correct 4 ms 4992 KB Output is correct
15 Correct 5 ms 7040 KB Output is correct
16 Correct 6 ms 7040 KB Output is correct
17 Correct 5 ms 7040 KB Output is correct
18 Correct 5 ms 7040 KB Output is correct
19 Correct 6 ms 7040 KB Output is correct
20 Correct 5 ms 7040 KB Output is correct
21 Correct 6 ms 8704 KB Output is correct
22 Correct 6 ms 8736 KB Output is correct
23 Correct 6 ms 8704 KB Output is correct
24 Correct 43 ms 28544 KB Output is correct
25 Correct 47 ms 28536 KB Output is correct
26 Correct 54 ms 28536 KB Output is correct
27 Correct 6 ms 6272 KB Output is correct
28 Correct 7 ms 6272 KB Output is correct
29 Correct 6 ms 5248 KB Output is correct
30 Correct 6 ms 5248 KB Output is correct
31 Correct 6 ms 5248 KB Output is correct
32 Correct 6 ms 5248 KB Output is correct
33 Correct 676 ms 74752 KB Output is correct
34 Correct 683 ms 74760 KB Output is correct
35 Correct 677 ms 74232 KB Output is correct
36 Correct 690 ms 74416 KB Output is correct
37 Correct 691 ms 74356 KB Output is correct
38 Correct 687 ms 74620 KB Output is correct
39 Correct 127 ms 179448 KB Output is correct
40 Correct 124 ms 179880 KB Output is correct
41 Correct 127 ms 179448 KB Output is correct
42 Correct 3 ms 4992 KB Output is correct
43 Correct 3 ms 4992 KB Output is correct
44 Correct 3 ms 4992 KB Output is correct
45 Correct 3 ms 4992 KB Output is correct
46 Correct 5 ms 5120 KB Output is correct
47 Correct 4 ms 5120 KB Output is correct
48 Correct 4 ms 5120 KB Output is correct
49 Correct 3 ms 5120 KB Output is correct
50 Correct 4 ms 5248 KB Output is correct
51 Correct 5 ms 6656 KB Output is correct
52 Correct 5 ms 6784 KB Output is correct
53 Correct 4 ms 6144 KB Output is correct
54 Correct 5 ms 6528 KB Output is correct
55 Correct 4 ms 6400 KB Output is correct
56 Correct 4 ms 5376 KB Output is correct
57 Correct 4 ms 4992 KB Output is correct
58 Correct 5 ms 8320 KB Output is correct
59 Correct 4 ms 5760 KB Output is correct
60 Correct 5 ms 7424 KB Output is correct
61 Correct 5 ms 6528 KB Output is correct
62 Correct 3 ms 4992 KB Output is correct
63 Correct 7 ms 5120 KB Output is correct
64 Correct 4 ms 5248 KB Output is correct
65 Correct 4 ms 5376 KB Output is correct
66 Correct 4 ms 5248 KB Output is correct
67 Correct 5 ms 5248 KB Output is correct
68 Correct 5 ms 7040 KB Output is correct
69 Correct 6 ms 7040 KB Output is correct
70 Correct 5 ms 7040 KB Output is correct
71 Correct 5 ms 7040 KB Output is correct
72 Correct 6 ms 7072 KB Output is correct
73 Correct 5 ms 7040 KB Output is correct
74 Correct 6 ms 8704 KB Output is correct
75 Correct 5 ms 5888 KB Output is correct
76 Correct 6 ms 8704 KB Output is correct
77 Correct 5 ms 5888 KB Output is correct
78 Correct 6 ms 8704 KB Output is correct
79 Correct 5 ms 5888 KB Output is correct
80 Correct 16 ms 5760 KB Output is correct
81 Correct 7 ms 5248 KB Output is correct
82 Correct 34 ms 5504 KB Output is correct
83 Correct 15 ms 5376 KB Output is correct
84 Correct 31 ms 5504 KB Output is correct
85 Correct 20 ms 19840 KB Output is correct
86 Correct 17 ms 15872 KB Output is correct
87 Correct 13 ms 9984 KB Output is correct
88 Correct 6 ms 6272 KB Output is correct
89 Correct 14 ms 13696 KB Output is correct
90 Correct 19 ms 20480 KB Output is correct
91 Correct 36 ms 15940 KB Output is correct
92 Correct 27 ms 8312 KB Output is correct
93 Correct 42 ms 11768 KB Output is correct
94 Correct 68 ms 5940 KB Output is correct
95 Correct 68 ms 5888 KB Output is correct
96 Correct 70 ms 6008 KB Output is correct
97 Correct 68 ms 5888 KB Output is correct
98 Correct 69 ms 5888 KB Output is correct
99 Correct 29 ms 23808 KB Output is correct
100 Correct 28 ms 23808 KB Output is correct
101 Correct 28 ms 23808 KB Output is correct
102 Correct 28 ms 24064 KB Output is correct
103 Correct 28 ms 23808 KB Output is correct
104 Correct 27 ms 23552 KB Output is correct
105 Correct 62 ms 28280 KB Output is correct
106 Correct 60 ms 28360 KB Output is correct
107 Correct 61 ms 28280 KB Output is correct
108 Correct 7 ms 6272 KB Output is correct
109 Execution timed out 1547 ms 8056 KB Time limit exceeded
110 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 4992 KB Output is correct
2 Correct 4 ms 4992 KB Output is correct
3 Correct 3 ms 4992 KB Output is correct
4 Correct 3 ms 4992 KB Output is correct
5 Correct 3 ms 4992 KB Output is correct
6 Correct 4 ms 5024 KB Output is correct
7 Correct 3 ms 4992 KB Output is correct
8 Correct 4 ms 4992 KB Output is correct
9 Correct 3 ms 4992 KB Output is correct
10 Correct 4 ms 4992 KB Output is correct
11 Correct 3 ms 4992 KB Output is correct
12 Correct 3 ms 4992 KB Output is correct
13 Correct 3 ms 4992 KB Output is correct
14 Correct 4 ms 4992 KB Output is correct
15 Correct 5 ms 7040 KB Output is correct
16 Correct 6 ms 7040 KB Output is correct
17 Correct 5 ms 7040 KB Output is correct
18 Correct 5 ms 7040 KB Output is correct
19 Correct 6 ms 7040 KB Output is correct
20 Correct 5 ms 7040 KB Output is correct
21 Correct 6 ms 8704 KB Output is correct
22 Correct 6 ms 8736 KB Output is correct
23 Correct 6 ms 8704 KB Output is correct
24 Correct 43 ms 28544 KB Output is correct
25 Correct 47 ms 28536 KB Output is correct
26 Correct 54 ms 28536 KB Output is correct
27 Correct 6 ms 6272 KB Output is correct
28 Correct 7 ms 6272 KB Output is correct
29 Correct 6 ms 5248 KB Output is correct
30 Correct 6 ms 5248 KB Output is correct
31 Correct 6 ms 5248 KB Output is correct
32 Correct 6 ms 5248 KB Output is correct
33 Correct 676 ms 74752 KB Output is correct
34 Correct 683 ms 74760 KB Output is correct
35 Correct 677 ms 74232 KB Output is correct
36 Correct 690 ms 74416 KB Output is correct
37 Correct 691 ms 74356 KB Output is correct
38 Correct 687 ms 74620 KB Output is correct
39 Correct 127 ms 179448 KB Output is correct
40 Correct 124 ms 179880 KB Output is correct
41 Correct 127 ms 179448 KB Output is correct
42 Correct 18 ms 10752 KB Output is correct
43 Correct 12 ms 8576 KB Output is correct
44 Correct 14 ms 6272 KB Output is correct
45 Correct 11 ms 5760 KB Output is correct
46 Correct 10 ms 5760 KB Output is correct
47 Correct 14 ms 6144 KB Output is correct
48 Runtime error 129 ms 56488 KB Execution killed with signal 11
49 Halted 0 ms 0 KB -