답안 #319487

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
319487 2020-11-05T11:39:09 Z VEGAnn 벽 칠하기 (APIO20_paint) C++14
51 / 100
1500 ms 18788 KB
#include "paint.h"
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
const int M = 50010;
const int N = 100100;
const int oo = 2e9;
gp_hash_table<int, bool> inside[M];
int f[N];

// проверить, вдруг на большие ограничения залетит

int minimumInstructions(int n, int m, int k, std::vector<int> C,
                         std::vector<int> A, std::vector<std::vector<int>> B) {

    for (int i = 0; i < m; i++) {
    for (int j = 0; j < A[i]; j++) {
        inside[i][B[i][j]] = 1;

//            cerr << B[i][j] << " ";
    }
//    cerr << '\n';
    }

    f[n] = 0;

    fill(f, f + n, oo);

    for (int i = n - m; i >= 0; i--){
        int mn = oo;

        for (int j = 1; j <= m; j++)
            mn = min(mn, f[i + j]);

        if (mn == oo) continue;

        for (int j = 0; j < m; j++){
            int now = j;
            bool ok = 1;

            for (int it = 0; it < m && ok; it++){
                if (inside[now].find(C[i + it]) == inside[now].end()){
                    ok = 0;
                    break;
                }

                now++;

                if (now == m) now = 0;
            }

            if (ok){
                f[i] = mn + 1;
                break;
            }
        }
    }

    return (f[0] == oo ? -1 : f[0]);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 10860 KB Output is correct
2 Correct 12 ms 10860 KB Output is correct
3 Correct 12 ms 10860 KB Output is correct
4 Correct 12 ms 10860 KB Output is correct
5 Correct 13 ms 10860 KB Output is correct
6 Correct 12 ms 10880 KB Output is correct
7 Correct 12 ms 10880 KB Output is correct
8 Correct 12 ms 10860 KB Output is correct
9 Correct 13 ms 10988 KB Output is correct
10 Correct 12 ms 10860 KB Output is correct
11 Correct 12 ms 10860 KB Output is correct
12 Correct 13 ms 10860 KB Output is correct
13 Correct 14 ms 10860 KB Output is correct
14 Correct 13 ms 10988 KB Output is correct
15 Correct 14 ms 10860 KB Output is correct
16 Correct 13 ms 10860 KB Output is correct
17 Correct 13 ms 10988 KB Output is correct
18 Correct 13 ms 11008 KB Output is correct
19 Correct 13 ms 11128 KB Output is correct
20 Correct 13 ms 11136 KB Output is correct
21 Correct 15 ms 10988 KB Output is correct
22 Correct 34 ms 14956 KB Output is correct
23 Correct 34 ms 14820 KB Output is correct
24 Correct 34 ms 15084 KB Output is correct
25 Correct 15 ms 11116 KB Output is correct
26 Correct 15 ms 11116 KB Output is correct
27 Correct 15 ms 11244 KB Output is correct
28 Correct 15 ms 11244 KB Output is correct
29 Correct 15 ms 11244 KB Output is correct
30 Correct 15 ms 11116 KB Output is correct
31 Correct 600 ms 12388 KB Output is correct
32 Correct 588 ms 12388 KB Output is correct
33 Correct 590 ms 12388 KB Output is correct
34 Correct 593 ms 12388 KB Output is correct
35 Correct 590 ms 12388 KB Output is correct
36 Correct 595 ms 12388 KB Output is correct
37 Correct 79 ms 15212 KB Output is correct
38 Correct 79 ms 15332 KB Output is correct
39 Correct 78 ms 15204 KB Output is correct
40 Correct 22 ms 12140 KB Output is correct
41 Correct 20 ms 11628 KB Output is correct
42 Correct 23 ms 12260 KB Output is correct
43 Correct 20 ms 11756 KB Output is correct
44 Correct 20 ms 11756 KB Output is correct
45 Correct 23 ms 12260 KB Output is correct
46 Execution timed out 1554 ms 18660 KB Time limit exceeded
47 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 10860 KB Output is correct
2 Correct 12 ms 10860 KB Output is correct
3 Correct 12 ms 10860 KB Output is correct
4 Correct 12 ms 10860 KB Output is correct
5 Correct 12 ms 10860 KB Output is correct
6 Correct 12 ms 10860 KB Output is correct
7 Correct 13 ms 10860 KB Output is correct
8 Correct 12 ms 10880 KB Output is correct
9 Correct 12 ms 10880 KB Output is correct
10 Correct 12 ms 10860 KB Output is correct
11 Correct 13 ms 10988 KB Output is correct
12 Correct 12 ms 10860 KB Output is correct
13 Correct 12 ms 10860 KB Output is correct
14 Correct 13 ms 10860 KB Output is correct
15 Correct 14 ms 10860 KB Output is correct
16 Correct 13 ms 10988 KB Output is correct
17 Correct 14 ms 10860 KB Output is correct
18 Correct 13 ms 10860 KB Output is correct
19 Correct 13 ms 10988 KB Output is correct
20 Correct 13 ms 11008 KB Output is correct
21 Correct 13 ms 11128 KB Output is correct
22 Correct 13 ms 11136 KB Output is correct
23 Correct 15 ms 10988 KB Output is correct
24 Correct 12 ms 10860 KB Output is correct
25 Correct 12 ms 10860 KB Output is correct
26 Correct 12 ms 10988 KB Output is correct
27 Correct 13 ms 10860 KB Output is correct
28 Correct 12 ms 10880 KB Output is correct
29 Correct 13 ms 10860 KB Output is correct
30 Correct 13 ms 10860 KB Output is correct
31 Correct 13 ms 10860 KB Output is correct
32 Correct 12 ms 10860 KB Output is correct
33 Correct 13 ms 10860 KB Output is correct
34 Correct 13 ms 10860 KB Output is correct
35 Correct 13 ms 10860 KB Output is correct
36 Correct 13 ms 10860 KB Output is correct
37 Correct 13 ms 11116 KB Output is correct
38 Correct 13 ms 10988 KB Output is correct
39 Correct 13 ms 10860 KB Output is correct
40 Correct 14 ms 11116 KB Output is correct
41 Correct 13 ms 10860 KB Output is correct
42 Correct 13 ms 10988 KB Output is correct
43 Correct 13 ms 10988 KB Output is correct
44 Correct 12 ms 11008 KB Output is correct
45 Correct 12 ms 10988 KB Output is correct
46 Correct 13 ms 10860 KB Output is correct
47 Correct 12 ms 10860 KB Output is correct
48 Correct 13 ms 10860 KB Output is correct
49 Correct 12 ms 10860 KB Output is correct
50 Correct 14 ms 10860 KB Output is correct
51 Correct 13 ms 10988 KB Output is correct
52 Correct 13 ms 10860 KB Output is correct
53 Correct 13 ms 11008 KB Output is correct
54 Correct 13 ms 10988 KB Output is correct
55 Correct 13 ms 10860 KB Output is correct
56 Correct 13 ms 10988 KB Output is correct
57 Correct 13 ms 10860 KB Output is correct
58 Correct 14 ms 11120 KB Output is correct
59 Correct 13 ms 10988 KB Output is correct
60 Correct 13 ms 10988 KB Output is correct
61 Correct 13 ms 10988 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 10860 KB Output is correct
2 Correct 12 ms 10860 KB Output is correct
3 Correct 12 ms 10860 KB Output is correct
4 Correct 12 ms 10860 KB Output is correct
5 Correct 12 ms 10860 KB Output is correct
6 Correct 12 ms 10860 KB Output is correct
7 Correct 13 ms 10860 KB Output is correct
8 Correct 12 ms 10880 KB Output is correct
9 Correct 12 ms 10880 KB Output is correct
10 Correct 12 ms 10860 KB Output is correct
11 Correct 13 ms 10988 KB Output is correct
12 Correct 12 ms 10860 KB Output is correct
13 Correct 12 ms 10860 KB Output is correct
14 Correct 13 ms 10860 KB Output is correct
15 Correct 14 ms 10860 KB Output is correct
16 Correct 13 ms 10988 KB Output is correct
17 Correct 14 ms 10860 KB Output is correct
18 Correct 13 ms 10860 KB Output is correct
19 Correct 13 ms 10988 KB Output is correct
20 Correct 13 ms 11008 KB Output is correct
21 Correct 13 ms 11128 KB Output is correct
22 Correct 13 ms 11136 KB Output is correct
23 Correct 15 ms 10988 KB Output is correct
24 Correct 34 ms 14956 KB Output is correct
25 Correct 34 ms 14820 KB Output is correct
26 Correct 34 ms 15084 KB Output is correct
27 Correct 12 ms 10860 KB Output is correct
28 Correct 12 ms 10860 KB Output is correct
29 Correct 12 ms 10988 KB Output is correct
30 Correct 13 ms 10860 KB Output is correct
31 Correct 12 ms 10880 KB Output is correct
32 Correct 13 ms 10860 KB Output is correct
33 Correct 13 ms 10860 KB Output is correct
34 Correct 13 ms 10860 KB Output is correct
35 Correct 12 ms 10860 KB Output is correct
36 Correct 13 ms 10860 KB Output is correct
37 Correct 13 ms 10860 KB Output is correct
38 Correct 13 ms 10860 KB Output is correct
39 Correct 13 ms 10860 KB Output is correct
40 Correct 13 ms 11116 KB Output is correct
41 Correct 13 ms 10988 KB Output is correct
42 Correct 13 ms 10860 KB Output is correct
43 Correct 14 ms 11116 KB Output is correct
44 Correct 13 ms 10860 KB Output is correct
45 Correct 13 ms 10988 KB Output is correct
46 Correct 13 ms 10988 KB Output is correct
47 Correct 12 ms 11008 KB Output is correct
48 Correct 12 ms 10988 KB Output is correct
49 Correct 13 ms 10860 KB Output is correct
50 Correct 12 ms 10860 KB Output is correct
51 Correct 13 ms 10860 KB Output is correct
52 Correct 12 ms 10860 KB Output is correct
53 Correct 14 ms 10860 KB Output is correct
54 Correct 13 ms 10988 KB Output is correct
55 Correct 13 ms 10860 KB Output is correct
56 Correct 13 ms 11008 KB Output is correct
57 Correct 13 ms 10988 KB Output is correct
58 Correct 13 ms 10860 KB Output is correct
59 Correct 13 ms 10988 KB Output is correct
60 Correct 13 ms 10860 KB Output is correct
61 Correct 14 ms 11120 KB Output is correct
62 Correct 13 ms 10988 KB Output is correct
63 Correct 13 ms 10988 KB Output is correct
64 Correct 13 ms 10988 KB Output is correct
65 Correct 13 ms 10892 KB Output is correct
66 Correct 13 ms 10860 KB Output is correct
67 Correct 13 ms 10860 KB Output is correct
68 Correct 13 ms 10860 KB Output is correct
69 Correct 13 ms 10988 KB Output is correct
70 Correct 17 ms 11372 KB Output is correct
71 Correct 17 ms 11648 KB Output is correct
72 Correct 16 ms 11500 KB Output is correct
73 Correct 15 ms 11244 KB Output is correct
74 Correct 16 ms 11372 KB Output is correct
75 Correct 16 ms 11372 KB Output is correct
76 Correct 35 ms 14956 KB Output is correct
77 Correct 40 ms 18272 KB Output is correct
78 Correct 46 ms 18788 KB Output is correct
79 Correct 16 ms 10860 KB Output is correct
80 Correct 13 ms 10860 KB Output is correct
81 Correct 13 ms 10860 KB Output is correct
82 Correct 13 ms 11020 KB Output is correct
83 Correct 13 ms 10988 KB Output is correct
84 Correct 18 ms 11756 KB Output is correct
85 Correct 19 ms 11628 KB Output is correct
86 Correct 18 ms 11628 KB Output is correct
87 Correct 20 ms 11628 KB Output is correct
88 Correct 18 ms 11756 KB Output is correct
89 Correct 18 ms 11628 KB Output is correct
90 Correct 51 ms 17128 KB Output is correct
91 Correct 44 ms 17124 KB Output is correct
92 Correct 46 ms 17124 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 10860 KB Output is correct
2 Correct 12 ms 10860 KB Output is correct
3 Correct 12 ms 10860 KB Output is correct
4 Correct 12 ms 10860 KB Output is correct
5 Correct 12 ms 10860 KB Output is correct
6 Correct 12 ms 10860 KB Output is correct
7 Correct 13 ms 10860 KB Output is correct
8 Correct 12 ms 10880 KB Output is correct
9 Correct 12 ms 10880 KB Output is correct
10 Correct 12 ms 10860 KB Output is correct
11 Correct 13 ms 10988 KB Output is correct
12 Correct 12 ms 10860 KB Output is correct
13 Correct 12 ms 10860 KB Output is correct
14 Correct 13 ms 10860 KB Output is correct
15 Correct 14 ms 10860 KB Output is correct
16 Correct 13 ms 10988 KB Output is correct
17 Correct 14 ms 10860 KB Output is correct
18 Correct 13 ms 10860 KB Output is correct
19 Correct 13 ms 10988 KB Output is correct
20 Correct 13 ms 11008 KB Output is correct
21 Correct 13 ms 11128 KB Output is correct
22 Correct 13 ms 11136 KB Output is correct
23 Correct 15 ms 10988 KB Output is correct
24 Correct 34 ms 14956 KB Output is correct
25 Correct 34 ms 14820 KB Output is correct
26 Correct 34 ms 15084 KB Output is correct
27 Correct 15 ms 11116 KB Output is correct
28 Correct 15 ms 11116 KB Output is correct
29 Correct 15 ms 11244 KB Output is correct
30 Correct 15 ms 11244 KB Output is correct
31 Correct 15 ms 11244 KB Output is correct
32 Correct 15 ms 11116 KB Output is correct
33 Correct 600 ms 12388 KB Output is correct
34 Correct 588 ms 12388 KB Output is correct
35 Correct 590 ms 12388 KB Output is correct
36 Correct 593 ms 12388 KB Output is correct
37 Correct 590 ms 12388 KB Output is correct
38 Correct 595 ms 12388 KB Output is correct
39 Correct 79 ms 15212 KB Output is correct
40 Correct 79 ms 15332 KB Output is correct
41 Correct 78 ms 15204 KB Output is correct
42 Correct 12 ms 10860 KB Output is correct
43 Correct 12 ms 10860 KB Output is correct
44 Correct 12 ms 10988 KB Output is correct
45 Correct 13 ms 10860 KB Output is correct
46 Correct 12 ms 10880 KB Output is correct
47 Correct 13 ms 10860 KB Output is correct
48 Correct 13 ms 10860 KB Output is correct
49 Correct 13 ms 10860 KB Output is correct
50 Correct 12 ms 10860 KB Output is correct
51 Correct 13 ms 10860 KB Output is correct
52 Correct 13 ms 10860 KB Output is correct
53 Correct 13 ms 10860 KB Output is correct
54 Correct 13 ms 10860 KB Output is correct
55 Correct 13 ms 11116 KB Output is correct
56 Correct 13 ms 10988 KB Output is correct
57 Correct 13 ms 10860 KB Output is correct
58 Correct 14 ms 11116 KB Output is correct
59 Correct 13 ms 10860 KB Output is correct
60 Correct 13 ms 10988 KB Output is correct
61 Correct 13 ms 10988 KB Output is correct
62 Correct 12 ms 11008 KB Output is correct
63 Correct 12 ms 10988 KB Output is correct
64 Correct 13 ms 10860 KB Output is correct
65 Correct 12 ms 10860 KB Output is correct
66 Correct 13 ms 10860 KB Output is correct
67 Correct 12 ms 10860 KB Output is correct
68 Correct 14 ms 10860 KB Output is correct
69 Correct 13 ms 10988 KB Output is correct
70 Correct 13 ms 10860 KB Output is correct
71 Correct 13 ms 11008 KB Output is correct
72 Correct 13 ms 10988 KB Output is correct
73 Correct 13 ms 10860 KB Output is correct
74 Correct 13 ms 10988 KB Output is correct
75 Correct 13 ms 10860 KB Output is correct
76 Correct 14 ms 11120 KB Output is correct
77 Correct 13 ms 10988 KB Output is correct
78 Correct 13 ms 10988 KB Output is correct
79 Correct 13 ms 10988 KB Output is correct
80 Correct 13 ms 10892 KB Output is correct
81 Correct 13 ms 10860 KB Output is correct
82 Correct 13 ms 10860 KB Output is correct
83 Correct 13 ms 10860 KB Output is correct
84 Correct 13 ms 10988 KB Output is correct
85 Correct 17 ms 11372 KB Output is correct
86 Correct 17 ms 11648 KB Output is correct
87 Correct 16 ms 11500 KB Output is correct
88 Correct 15 ms 11244 KB Output is correct
89 Correct 16 ms 11372 KB Output is correct
90 Correct 16 ms 11372 KB Output is correct
91 Correct 35 ms 14956 KB Output is correct
92 Correct 40 ms 18272 KB Output is correct
93 Correct 46 ms 18788 KB Output is correct
94 Correct 16 ms 10860 KB Output is correct
95 Correct 13 ms 10860 KB Output is correct
96 Correct 13 ms 10860 KB Output is correct
97 Correct 13 ms 11020 KB Output is correct
98 Correct 13 ms 10988 KB Output is correct
99 Correct 18 ms 11756 KB Output is correct
100 Correct 19 ms 11628 KB Output is correct
101 Correct 18 ms 11628 KB Output is correct
102 Correct 20 ms 11628 KB Output is correct
103 Correct 18 ms 11756 KB Output is correct
104 Correct 18 ms 11628 KB Output is correct
105 Correct 51 ms 17128 KB Output is correct
106 Correct 44 ms 17124 KB Output is correct
107 Correct 46 ms 17124 KB Output is correct
108 Correct 15 ms 11116 KB Output is correct
109 Correct 59 ms 11116 KB Output is correct
110 Correct 23 ms 11244 KB Output is correct
111 Correct 23 ms 11116 KB Output is correct
112 Correct 26 ms 11240 KB Output is correct
113 Correct 24 ms 11116 KB Output is correct
114 Correct 352 ms 13408 KB Output is correct
115 Correct 48 ms 13548 KB Output is correct
116 Correct 347 ms 14220 KB Output is correct
117 Correct 221 ms 14052 KB Output is correct
118 Correct 55 ms 14188 KB Output is correct
119 Correct 546 ms 12900 KB Output is correct
120 Correct 59 ms 15084 KB Output is correct
121 Correct 318 ms 11748 KB Output is correct
122 Correct 46 ms 15716 KB Output is correct
123 Correct 104 ms 11628 KB Output is correct
124 Correct 44 ms 16228 KB Output is correct
125 Correct 74 ms 12036 KB Output is correct
126 Correct 27 ms 12416 KB Output is correct
127 Correct 277 ms 12516 KB Output is correct
128 Correct 58 ms 12268 KB Output is correct
129 Correct 94 ms 12012 KB Output is correct
130 Correct 14 ms 11116 KB Output is correct
131 Correct 80 ms 11244 KB Output is correct
132 Correct 32 ms 11372 KB Output is correct
133 Correct 35 ms 11244 KB Output is correct
134 Correct 38 ms 11244 KB Output is correct
135 Correct 37 ms 11244 KB Output is correct
136 Correct 987 ms 15076 KB Output is correct
137 Correct 892 ms 15076 KB Output is correct
138 Correct 1018 ms 15204 KB Output is correct
139 Correct 947 ms 15204 KB Output is correct
140 Correct 894 ms 15208 KB Output is correct
141 Correct 980 ms 15212 KB Output is correct
142 Correct 93 ms 18532 KB Output is correct
143 Correct 593 ms 12268 KB Output is correct
144 Correct 99 ms 18536 KB Output is correct
145 Correct 587 ms 12388 KB Output is correct
146 Correct 98 ms 18532 KB Output is correct
147 Correct 588 ms 12516 KB Output is correct
148 Correct 1064 ms 12516 KB Output is correct
149 Correct 586 ms 12512 KB Output is correct
150 Correct 322 ms 12800 KB Output is correct
151 Correct 289 ms 12516 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 10860 KB Output is correct
2 Correct 12 ms 10860 KB Output is correct
3 Correct 12 ms 10860 KB Output is correct
4 Correct 12 ms 10860 KB Output is correct
5 Correct 12 ms 10860 KB Output is correct
6 Correct 12 ms 10860 KB Output is correct
7 Correct 13 ms 10860 KB Output is correct
8 Correct 12 ms 10880 KB Output is correct
9 Correct 12 ms 10880 KB Output is correct
10 Correct 12 ms 10860 KB Output is correct
11 Correct 13 ms 10988 KB Output is correct
12 Correct 12 ms 10860 KB Output is correct
13 Correct 12 ms 10860 KB Output is correct
14 Correct 13 ms 10860 KB Output is correct
15 Correct 14 ms 10860 KB Output is correct
16 Correct 13 ms 10988 KB Output is correct
17 Correct 14 ms 10860 KB Output is correct
18 Correct 13 ms 10860 KB Output is correct
19 Correct 13 ms 10988 KB Output is correct
20 Correct 13 ms 11008 KB Output is correct
21 Correct 13 ms 11128 KB Output is correct
22 Correct 13 ms 11136 KB Output is correct
23 Correct 15 ms 10988 KB Output is correct
24 Correct 34 ms 14956 KB Output is correct
25 Correct 34 ms 14820 KB Output is correct
26 Correct 34 ms 15084 KB Output is correct
27 Correct 15 ms 11116 KB Output is correct
28 Correct 15 ms 11116 KB Output is correct
29 Correct 15 ms 11244 KB Output is correct
30 Correct 15 ms 11244 KB Output is correct
31 Correct 15 ms 11244 KB Output is correct
32 Correct 15 ms 11116 KB Output is correct
33 Correct 600 ms 12388 KB Output is correct
34 Correct 588 ms 12388 KB Output is correct
35 Correct 590 ms 12388 KB Output is correct
36 Correct 593 ms 12388 KB Output is correct
37 Correct 590 ms 12388 KB Output is correct
38 Correct 595 ms 12388 KB Output is correct
39 Correct 79 ms 15212 KB Output is correct
40 Correct 79 ms 15332 KB Output is correct
41 Correct 78 ms 15204 KB Output is correct
42 Correct 22 ms 12140 KB Output is correct
43 Correct 20 ms 11628 KB Output is correct
44 Correct 23 ms 12260 KB Output is correct
45 Correct 20 ms 11756 KB Output is correct
46 Correct 20 ms 11756 KB Output is correct
47 Correct 23 ms 12260 KB Output is correct
48 Execution timed out 1554 ms 18660 KB Time limit exceeded
49 Halted 0 ms 0 KB -