답안 #567356

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
567356 2022-05-23T10:51:10 Z Stickfish 벽 칠하기 (APIO20_paint) C++17
51 / 100
1500 ms 10852 KB
#include "paint.h"
#include <vector>
#include <bitset>
using namespace std;

const int MAXN = 100001;
const int MAXM = 208;
bitset<MAXM> rgoodcl[MAXN];

bool get_good_seg(int n, int m, int k, vector<int>& cl, vector<vector<int>>& goodcl, int l) {
    if (l > n - m)
        return false;
    for (int md = 0; md < m; ++md) {
        bool isok = true;
        for (int i = 0; i < m && isok; ++i) {
            isok &= rgoodcl[cl[i + l]][(md + i) % m];
        }
        if (isok) {
            return true;
        }
    }
    return false;
}

int minimumInstructions(int n, int m, int k, vector<int> cl, vector<int> a, vector<vector<int>> goodcl) {
    for (int i = 0; i < m; ++i) {
        for (auto ccl : goodcl[i])
            rgoodcl[ccl][i] = 1;
    }
    int endcvr = 0;
    int maxcvr = 0;
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        if (get_good_seg(n, m, k, cl, goodcl, i))
            maxcvr = i + m;
        if (i >= endcvr) {
            endcvr = maxcvr;
            ++ans;
        }
        if (i >= endcvr)
            return -1;
    }
    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 232 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 2 ms 1748 KB Output is correct
14 Correct 2 ms 1748 KB Output is correct
15 Correct 2 ms 1748 KB Output is correct
16 Correct 2 ms 1748 KB Output is correct
17 Correct 2 ms 1748 KB Output is correct
18 Correct 2 ms 1748 KB Output is correct
19 Correct 1 ms 2516 KB Output is correct
20 Correct 2 ms 2516 KB Output is correct
21 Correct 2 ms 2516 KB Output is correct
22 Correct 16 ms 4692 KB Output is correct
23 Correct 13 ms 4744 KB Output is correct
24 Correct 18 ms 4748 KB Output is correct
25 Correct 3 ms 468 KB Output is correct
26 Correct 3 ms 468 KB Output is correct
27 Correct 2 ms 468 KB Output is correct
28 Correct 2 ms 468 KB Output is correct
29 Correct 4 ms 468 KB Output is correct
30 Correct 2 ms 468 KB Output is correct
31 Correct 286 ms 4084 KB Output is correct
32 Correct 305 ms 4084 KB Output is correct
33 Correct 283 ms 4084 KB Output is correct
34 Correct 296 ms 4052 KB Output is correct
35 Correct 310 ms 4080 KB Output is correct
36 Correct 302 ms 4084 KB Output is correct
37 Correct 16 ms 5084 KB Output is correct
38 Correct 16 ms 5080 KB Output is correct
39 Correct 16 ms 5156 KB Output is correct
40 Correct 11 ms 1188 KB Output is correct
41 Correct 6 ms 764 KB Output is correct
42 Correct 13 ms 1268 KB Output is correct
43 Correct 7 ms 928 KB Output is correct
44 Correct 8 ms 872 KB Output is correct
45 Correct 9 ms 1276 KB Output is correct
46 Execution timed out 1566 ms 10852 KB Time limit exceeded
47 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 232 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 2 ms 1748 KB Output is correct
14 Correct 2 ms 1748 KB Output is correct
15 Correct 2 ms 1748 KB Output is correct
16 Correct 2 ms 1748 KB Output is correct
17 Correct 2 ms 1748 KB Output is correct
18 Correct 2 ms 1748 KB Output is correct
19 Correct 1 ms 2516 KB Output is correct
20 Correct 2 ms 2516 KB Output is correct
21 Correct 2 ms 2516 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 1 ms 300 KB Output is correct
25 Correct 0 ms 292 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 0 ms 292 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
33 Correct 2 ms 1492 KB Output is correct
34 Correct 1 ms 1364 KB Output is correct
35 Correct 2 ms 1108 KB Output is correct
36 Correct 1 ms 1492 KB Output is correct
37 Correct 1 ms 1364 KB Output is correct
38 Correct 1 ms 2260 KB Output is correct
39 Correct 1 ms 212 KB Output is correct
40 Correct 2 ms 2132 KB Output is correct
41 Correct 1 ms 212 KB Output is correct
42 Correct 1 ms 2132 KB Output is correct
43 Correct 1 ms 1236 KB Output is correct
44 Correct 1 ms 212 KB Output is correct
45 Correct 1 ms 212 KB Output is correct
46 Correct 1 ms 212 KB Output is correct
47 Correct 1 ms 296 KB Output is correct
48 Correct 1 ms 212 KB Output is correct
49 Correct 1 ms 212 KB Output is correct
50 Correct 2 ms 1748 KB Output is correct
51 Correct 2 ms 1704 KB Output is correct
52 Correct 2 ms 1748 KB Output is correct
53 Correct 2 ms 1748 KB Output is correct
54 Correct 2 ms 1748 KB Output is correct
55 Correct 2 ms 1712 KB Output is correct
56 Correct 2 ms 2516 KB Output is correct
57 Correct 1 ms 340 KB Output is correct
58 Correct 2 ms 2516 KB Output is correct
59 Correct 1 ms 340 KB Output is correct
60 Correct 2 ms 2480 KB Output is correct
61 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 232 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 2 ms 1748 KB Output is correct
16 Correct 2 ms 1748 KB Output is correct
17 Correct 2 ms 1748 KB Output is correct
18 Correct 2 ms 1748 KB Output is correct
19 Correct 2 ms 1748 KB Output is correct
20 Correct 2 ms 1748 KB Output is correct
21 Correct 1 ms 2516 KB Output is correct
22 Correct 2 ms 2516 KB Output is correct
23 Correct 2 ms 2516 KB Output is correct
24 Correct 16 ms 4692 KB Output is correct
25 Correct 13 ms 4744 KB Output is correct
26 Correct 18 ms 4748 KB Output is correct
27 Correct 1 ms 300 KB Output is correct
28 Correct 0 ms 292 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 1 ms 212 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
33 Correct 0 ms 292 KB Output is correct
34 Correct 1 ms 212 KB Output is correct
35 Correct 1 ms 212 KB Output is correct
36 Correct 2 ms 1492 KB Output is correct
37 Correct 1 ms 1364 KB Output is correct
38 Correct 2 ms 1108 KB Output is correct
39 Correct 1 ms 1492 KB Output is correct
40 Correct 1 ms 1364 KB Output is correct
41 Correct 1 ms 2260 KB Output is correct
42 Correct 1 ms 212 KB Output is correct
43 Correct 2 ms 2132 KB Output is correct
44 Correct 1 ms 212 KB Output is correct
45 Correct 1 ms 2132 KB Output is correct
46 Correct 1 ms 1236 KB Output is correct
47 Correct 1 ms 212 KB Output is correct
48 Correct 1 ms 212 KB Output is correct
49 Correct 1 ms 212 KB Output is correct
50 Correct 1 ms 296 KB Output is correct
51 Correct 1 ms 212 KB Output is correct
52 Correct 1 ms 212 KB Output is correct
53 Correct 2 ms 1748 KB Output is correct
54 Correct 2 ms 1704 KB Output is correct
55 Correct 2 ms 1748 KB Output is correct
56 Correct 2 ms 1748 KB Output is correct
57 Correct 2 ms 1748 KB Output is correct
58 Correct 2 ms 1712 KB Output is correct
59 Correct 2 ms 2516 KB Output is correct
60 Correct 1 ms 340 KB Output is correct
61 Correct 2 ms 2516 KB Output is correct
62 Correct 1 ms 340 KB Output is correct
63 Correct 2 ms 2480 KB Output is correct
64 Correct 1 ms 348 KB Output is correct
65 Correct 1 ms 212 KB Output is correct
66 Correct 1 ms 212 KB Output is correct
67 Correct 1 ms 300 KB Output is correct
68 Correct 1 ms 212 KB Output is correct
69 Correct 1 ms 212 KB Output is correct
70 Correct 3 ms 1620 KB Output is correct
71 Correct 3 ms 1588 KB Output is correct
72 Correct 2 ms 1492 KB Output is correct
73 Correct 2 ms 1492 KB Output is correct
74 Correct 3 ms 1492 KB Output is correct
75 Correct 3 ms 1364 KB Output is correct
76 Correct 14 ms 3924 KB Output is correct
77 Correct 16 ms 4572 KB Output is correct
78 Correct 18 ms 5196 KB Output is correct
79 Correct 1 ms 212 KB Output is correct
80 Correct 1 ms 212 KB Output is correct
81 Correct 1 ms 212 KB Output is correct
82 Correct 1 ms 212 KB Output is correct
83 Correct 1 ms 212 KB Output is correct
84 Correct 4 ms 1972 KB Output is correct
85 Correct 4 ms 1876 KB Output is correct
86 Correct 4 ms 1876 KB Output is correct
87 Correct 4 ms 2020 KB Output is correct
88 Correct 3 ms 2004 KB Output is correct
89 Correct 4 ms 1876 KB Output is correct
90 Correct 20 ms 5544 KB Output is correct
91 Correct 27 ms 5476 KB Output is correct
92 Correct 19 ms 5556 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 232 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 2 ms 1748 KB Output is correct
16 Correct 2 ms 1748 KB Output is correct
17 Correct 2 ms 1748 KB Output is correct
18 Correct 2 ms 1748 KB Output is correct
19 Correct 2 ms 1748 KB Output is correct
20 Correct 2 ms 1748 KB Output is correct
21 Correct 1 ms 2516 KB Output is correct
22 Correct 2 ms 2516 KB Output is correct
23 Correct 2 ms 2516 KB Output is correct
24 Correct 16 ms 4692 KB Output is correct
25 Correct 13 ms 4744 KB Output is correct
26 Correct 18 ms 4748 KB Output is correct
27 Correct 3 ms 468 KB Output is correct
28 Correct 3 ms 468 KB Output is correct
29 Correct 2 ms 468 KB Output is correct
30 Correct 2 ms 468 KB Output is correct
31 Correct 4 ms 468 KB Output is correct
32 Correct 2 ms 468 KB Output is correct
33 Correct 286 ms 4084 KB Output is correct
34 Correct 305 ms 4084 KB Output is correct
35 Correct 283 ms 4084 KB Output is correct
36 Correct 296 ms 4052 KB Output is correct
37 Correct 310 ms 4080 KB Output is correct
38 Correct 302 ms 4084 KB Output is correct
39 Correct 16 ms 5084 KB Output is correct
40 Correct 16 ms 5080 KB Output is correct
41 Correct 16 ms 5156 KB Output is correct
42 Correct 1 ms 300 KB Output is correct
43 Correct 0 ms 292 KB Output is correct
44 Correct 1 ms 212 KB Output is correct
45 Correct 1 ms 212 KB Output is correct
46 Correct 1 ms 212 KB Output is correct
47 Correct 1 ms 212 KB Output is correct
48 Correct 0 ms 292 KB Output is correct
49 Correct 1 ms 212 KB Output is correct
50 Correct 1 ms 212 KB Output is correct
51 Correct 2 ms 1492 KB Output is correct
52 Correct 1 ms 1364 KB Output is correct
53 Correct 2 ms 1108 KB Output is correct
54 Correct 1 ms 1492 KB Output is correct
55 Correct 1 ms 1364 KB Output is correct
56 Correct 1 ms 2260 KB Output is correct
57 Correct 1 ms 212 KB Output is correct
58 Correct 2 ms 2132 KB Output is correct
59 Correct 1 ms 212 KB Output is correct
60 Correct 1 ms 2132 KB Output is correct
61 Correct 1 ms 1236 KB Output is correct
62 Correct 1 ms 212 KB Output is correct
63 Correct 1 ms 212 KB Output is correct
64 Correct 1 ms 212 KB Output is correct
65 Correct 1 ms 296 KB Output is correct
66 Correct 1 ms 212 KB Output is correct
67 Correct 1 ms 212 KB Output is correct
68 Correct 2 ms 1748 KB Output is correct
69 Correct 2 ms 1704 KB Output is correct
70 Correct 2 ms 1748 KB Output is correct
71 Correct 2 ms 1748 KB Output is correct
72 Correct 2 ms 1748 KB Output is correct
73 Correct 2 ms 1712 KB Output is correct
74 Correct 2 ms 2516 KB Output is correct
75 Correct 1 ms 340 KB Output is correct
76 Correct 2 ms 2516 KB Output is correct
77 Correct 1 ms 340 KB Output is correct
78 Correct 2 ms 2480 KB Output is correct
79 Correct 1 ms 348 KB Output is correct
80 Correct 1 ms 212 KB Output is correct
81 Correct 1 ms 212 KB Output is correct
82 Correct 1 ms 300 KB Output is correct
83 Correct 1 ms 212 KB Output is correct
84 Correct 1 ms 212 KB Output is correct
85 Correct 3 ms 1620 KB Output is correct
86 Correct 3 ms 1588 KB Output is correct
87 Correct 2 ms 1492 KB Output is correct
88 Correct 2 ms 1492 KB Output is correct
89 Correct 3 ms 1492 KB Output is correct
90 Correct 3 ms 1364 KB Output is correct
91 Correct 14 ms 3924 KB Output is correct
92 Correct 16 ms 4572 KB Output is correct
93 Correct 18 ms 5196 KB Output is correct
94 Correct 1 ms 212 KB Output is correct
95 Correct 1 ms 212 KB Output is correct
96 Correct 1 ms 212 KB Output is correct
97 Correct 1 ms 212 KB Output is correct
98 Correct 1 ms 212 KB Output is correct
99 Correct 4 ms 1972 KB Output is correct
100 Correct 4 ms 1876 KB Output is correct
101 Correct 4 ms 1876 KB Output is correct
102 Correct 4 ms 2020 KB Output is correct
103 Correct 3 ms 2004 KB Output is correct
104 Correct 4 ms 1876 KB Output is correct
105 Correct 20 ms 5544 KB Output is correct
106 Correct 27 ms 5476 KB Output is correct
107 Correct 19 ms 5556 KB Output is correct
108 Correct 3 ms 412 KB Output is correct
109 Correct 45 ms 484 KB Output is correct
110 Correct 2 ms 468 KB Output is correct
111 Correct 2 ms 432 KB Output is correct
112 Correct 3 ms 468 KB Output is correct
113 Correct 3 ms 468 KB Output is correct
114 Correct 153 ms 4352 KB Output is correct
115 Correct 20 ms 3924 KB Output is correct
116 Correct 152 ms 4492 KB Output is correct
117 Correct 116 ms 3412 KB Output is correct
118 Correct 25 ms 4052 KB Output is correct
119 Correct 238 ms 4180 KB Output is correct
120 Correct 14 ms 3780 KB Output is correct
121 Correct 162 ms 1108 KB Output is correct
122 Correct 16 ms 3796 KB Output is correct
123 Correct 54 ms 980 KB Output is correct
124 Correct 18 ms 4712 KB Output is correct
125 Correct 28 ms 1364 KB Output is correct
126 Correct 11 ms 2480 KB Output is correct
127 Correct 109 ms 3488 KB Output is correct
128 Correct 23 ms 3028 KB Output is correct
129 Correct 34 ms 2388 KB Output is correct
130 Correct 3 ms 436 KB Output is correct
131 Correct 65 ms 468 KB Output is correct
132 Correct 3 ms 468 KB Output is correct
133 Correct 3 ms 596 KB Output is correct
134 Correct 3 ms 544 KB Output is correct
135 Correct 3 ms 564 KB Output is correct
136 Correct 454 ms 4936 KB Output is correct
137 Correct 403 ms 4932 KB Output is correct
138 Correct 468 ms 4948 KB Output is correct
139 Correct 441 ms 4836 KB Output is correct
140 Correct 408 ms 4932 KB Output is correct
141 Correct 447 ms 4932 KB Output is correct
142 Correct 32 ms 5964 KB Output is correct
143 Correct 285 ms 1568 KB Output is correct
144 Correct 25 ms 5908 KB Output is correct
145 Correct 281 ms 1568 KB Output is correct
146 Correct 22 ms 5892 KB Output is correct
147 Correct 301 ms 1568 KB Output is correct
148 Correct 353 ms 4272 KB Output is correct
149 Correct 176 ms 4180 KB Output is correct
150 Correct 122 ms 4052 KB Output is correct
151 Correct 96 ms 4104 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 232 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 2 ms 1748 KB Output is correct
16 Correct 2 ms 1748 KB Output is correct
17 Correct 2 ms 1748 KB Output is correct
18 Correct 2 ms 1748 KB Output is correct
19 Correct 2 ms 1748 KB Output is correct
20 Correct 2 ms 1748 KB Output is correct
21 Correct 1 ms 2516 KB Output is correct
22 Correct 2 ms 2516 KB Output is correct
23 Correct 2 ms 2516 KB Output is correct
24 Correct 16 ms 4692 KB Output is correct
25 Correct 13 ms 4744 KB Output is correct
26 Correct 18 ms 4748 KB Output is correct
27 Correct 3 ms 468 KB Output is correct
28 Correct 3 ms 468 KB Output is correct
29 Correct 2 ms 468 KB Output is correct
30 Correct 2 ms 468 KB Output is correct
31 Correct 4 ms 468 KB Output is correct
32 Correct 2 ms 468 KB Output is correct
33 Correct 286 ms 4084 KB Output is correct
34 Correct 305 ms 4084 KB Output is correct
35 Correct 283 ms 4084 KB Output is correct
36 Correct 296 ms 4052 KB Output is correct
37 Correct 310 ms 4080 KB Output is correct
38 Correct 302 ms 4084 KB Output is correct
39 Correct 16 ms 5084 KB Output is correct
40 Correct 16 ms 5080 KB Output is correct
41 Correct 16 ms 5156 KB Output is correct
42 Correct 11 ms 1188 KB Output is correct
43 Correct 6 ms 764 KB Output is correct
44 Correct 13 ms 1268 KB Output is correct
45 Correct 7 ms 928 KB Output is correct
46 Correct 8 ms 872 KB Output is correct
47 Correct 9 ms 1276 KB Output is correct
48 Execution timed out 1566 ms 10852 KB Time limit exceeded
49 Halted 0 ms 0 KB -