답안 #850128

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
850128 2023-09-15T19:20:56 Z tvladm2009 벽 칠하기 (APIO20_paint) C++17
63 / 100
753 ms 524288 KB
#include "paint.h"
 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
 
int n, m, k;
 
int minimumInstructions(int N, int M, int K, vector<int> C, vector<int> A, vector<vector<int>> B) {
        vector<int> a, c;
        vector<vector<int>> b;
 
        n = N;
        m = M;
        k = K;
        c = C;
        a = A;
        b = B;
        assert((int)c.size() == n);
        assert((int)a.size() == m);
        assert((int)b.size() == m);
        for (int i = 0; i < m; i++) {
                assert((int)b[i].size() == a[i]);
        }
 
        vector<int> f(k, 0);
        for (int i = 0; i < m; i++) {
                for (auto& it : b[i]) {
                        f[it]++;
                }
        }
        bool subtask1 = 1;
        for (int i = 0; i < k; i++) {
                if (f[i] > 1) {
                        subtask1 = 0;
                }
        }
        
        if (subtask1) {
                vector<int> has(k, -1);
                vector<int> need(n, 0);
                for (int i = 0; i < m; i++) {
                        for (auto& it : b[i]) {
                                has[it] = i;
                        }
                }
                for (int i = 0; i < n; i++) {
                        if (f[c[i]] == 0) {
                                return -1;
                        }
                        need[i] = has[c[i]];
                }
                int sol = 0, pos = need[0], cur = 1;
                for (int i = 1; i < n; i++) {
                        bool ok = false;
                        ok |= (need[i] == (pos + 1) % m);
         
                        if (!ok) {
                                if (cur < m) {
                                        return -1;
                                }
                                sol += (cur + m - 1) / m;
                                cur = 0;
                        }
                        cur++;
                        pos = need[i];
                }
                if (cur < m) {
                        return -1;
                }
                sol += (cur + m - 1) / m;
                return sol;
        }
 
 
        vector<bool> isok(n * m, 0), ok(n, 0);
        vector<int> best(n * m, 0);
 
        vector<bool> act(k, 0);
 
        for (int w = 0; w < m; w++) {
                for (auto& col : b[w]) {
                        act[col] = 1;
                }
                for (int i = 0; i < n; i++) {
                        if (act[c[i]]) {
                                isok[i * m + w] = 1;
                        }
                }
                for (auto& col : b[w]) {
                        act[col] = 0;
                }
        }
 
        for (int i = n - 1; i >= 0; i--) {
                for (int w = 0; w < m; w++) {
                        if (isok[i * m + w]) {
                                best[i * m + w] = 1;
                                if (i + 1 < n) {
                                        best[i * m + w] += best[(i + 1) * m + (w + 1) % m];
                                }
                        }
                }
        }
 
        for (int y = 0; y + m - 1 < n; y++) {
                for (int w = 0; w < m; w++) {
                        if (best[y * m + w] >= m) {
                                ok[y] = 1;
                        }
                }
        }
 
        vector<int> inds;
        for (int i = 0; i < n; i++) {
                if (ok[i]) {
                        inds.push_back(i);
                }
        }
        if (inds.empty()) {
                return -1;
        }
        assert((int) inds.size() >= 1);
        if (inds[0] != 0 || inds.back() != n - m) {
                return -1;
        }
        int l = 0, cost = 0;
        while (1) {
                int r = l;
                cost++;
                while (r + 1 < (int) inds.size() && inds[r + 1] <= inds[l] + m) {
                        r++;
                }
                if (r == (int) inds.size() - 1) {
                        if (l < r) {
                                cost++;
                        }
                        break;
                }
                if (l == r) {
                        return -1;
                }
                l = r;
        }
        return cost;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 1116 KB Output is correct
14 Correct 1 ms 1116 KB Output is correct
15 Correct 1 ms 1116 KB Output is correct
16 Correct 1 ms 1116 KB Output is correct
17 Correct 1 ms 1116 KB Output is correct
18 Correct 1 ms 1116 KB Output is correct
19 Correct 1 ms 1168 KB Output is correct
20 Correct 1 ms 1368 KB Output is correct
21 Correct 1 ms 1112 KB Output is correct
22 Correct 8 ms 2396 KB Output is correct
23 Correct 8 ms 2268 KB Output is correct
24 Correct 8 ms 2412 KB Output is correct
25 Correct 2 ms 604 KB Output is correct
26 Correct 2 ms 604 KB Output is correct
27 Correct 2 ms 600 KB Output is correct
28 Correct 2 ms 604 KB Output is correct
29 Correct 2 ms 604 KB Output is correct
30 Correct 2 ms 604 KB Output is correct
31 Correct 5 ms 1884 KB Output is correct
32 Correct 4 ms 2136 KB Output is correct
33 Correct 4 ms 1884 KB Output is correct
34 Correct 4 ms 1884 KB Output is correct
35 Correct 4 ms 1884 KB Output is correct
36 Correct 4 ms 1884 KB Output is correct
37 Correct 10 ms 2812 KB Output is correct
38 Correct 10 ms 2908 KB Output is correct
39 Correct 10 ms 2908 KB Output is correct
40 Correct 6 ms 1628 KB Output is correct
41 Correct 4 ms 1180 KB Output is correct
42 Correct 7 ms 2136 KB Output is correct
43 Correct 5 ms 1372 KB Output is correct
44 Correct 4 ms 1372 KB Output is correct
45 Correct 7 ms 1864 KB Output is correct
46 Correct 26 ms 11120 KB Output is correct
47 Correct 21 ms 6220 KB Output is correct
48 Correct 23 ms 10036 KB Output is correct
49 Correct 23 ms 8796 KB Output is correct
50 Correct 22 ms 8028 KB Output is correct
51 Correct 20 ms 5468 KB Output is correct
52 Correct 7 ms 1964 KB Output is correct
53 Correct 7 ms 1884 KB Output is correct
54 Correct 7 ms 1880 KB Output is correct
55 Correct 7 ms 1880 KB Output is correct
56 Correct 7 ms 1884 KB Output is correct
57 Correct 7 ms 1884 KB Output is correct
58 Correct 29 ms 11348 KB Output is correct
59 Correct 30 ms 11608 KB Output is correct
60 Correct 28 ms 11756 KB Output is correct
61 Correct 28 ms 11560 KB Output is correct
62 Correct 28 ms 11344 KB Output is correct
63 Correct 28 ms 11612 KB Output is correct
64 Correct 28 ms 10328 KB Output is correct
65 Correct 29 ms 10588 KB Output is correct
66 Correct 27 ms 10352 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 1116 KB Output is correct
14 Correct 1 ms 1116 KB Output is correct
15 Correct 1 ms 1116 KB Output is correct
16 Correct 1 ms 1116 KB Output is correct
17 Correct 1 ms 1116 KB Output is correct
18 Correct 1 ms 1116 KB Output is correct
19 Correct 1 ms 1168 KB Output is correct
20 Correct 1 ms 1368 KB Output is correct
21 Correct 1 ms 1112 KB Output is correct
22 Correct 0 ms 344 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 1 ms 860 KB Output is correct
34 Correct 1 ms 856 KB Output is correct
35 Correct 1 ms 600 KB Output is correct
36 Correct 1 ms 856 KB Output is correct
37 Correct 1 ms 860 KB Output is correct
38 Correct 1 ms 604 KB Output is correct
39 Correct 0 ms 348 KB Output is correct
40 Correct 1 ms 860 KB Output is correct
41 Correct 1 ms 604 KB Output is correct
42 Correct 1 ms 856 KB Output is correct
43 Correct 1 ms 860 KB Output is correct
44 Correct 0 ms 348 KB Output is correct
45 Correct 1 ms 348 KB Output is correct
46 Correct 1 ms 348 KB Output is correct
47 Correct 1 ms 348 KB Output is correct
48 Correct 1 ms 348 KB Output is correct
49 Correct 1 ms 348 KB Output is correct
50 Correct 1 ms 1116 KB Output is correct
51 Correct 1 ms 1116 KB Output is correct
52 Correct 1 ms 1116 KB Output is correct
53 Correct 1 ms 1116 KB Output is correct
54 Correct 1 ms 1116 KB Output is correct
55 Correct 1 ms 1116 KB Output is correct
56 Correct 1 ms 1116 KB Output is correct
57 Correct 1 ms 860 KB Output is correct
58 Correct 1 ms 1116 KB Output is correct
59 Correct 1 ms 860 KB Output is correct
60 Correct 1 ms 1116 KB Output is correct
61 Correct 1 ms 860 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 1116 KB Output is correct
16 Correct 1 ms 1116 KB Output is correct
17 Correct 1 ms 1116 KB Output is correct
18 Correct 1 ms 1116 KB Output is correct
19 Correct 1 ms 1116 KB Output is correct
20 Correct 1 ms 1116 KB Output is correct
21 Correct 1 ms 1168 KB Output is correct
22 Correct 1 ms 1368 KB Output is correct
23 Correct 1 ms 1112 KB Output is correct
24 Correct 8 ms 2396 KB Output is correct
25 Correct 8 ms 2268 KB Output is correct
26 Correct 8 ms 2412 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 0 ms 348 KB Output is correct
36 Correct 1 ms 860 KB Output is correct
37 Correct 1 ms 856 KB Output is correct
38 Correct 1 ms 600 KB Output is correct
39 Correct 1 ms 856 KB Output is correct
40 Correct 1 ms 860 KB Output is correct
41 Correct 1 ms 604 KB Output is correct
42 Correct 0 ms 348 KB Output is correct
43 Correct 1 ms 860 KB Output is correct
44 Correct 1 ms 604 KB Output is correct
45 Correct 1 ms 856 KB Output is correct
46 Correct 1 ms 860 KB Output is correct
47 Correct 0 ms 348 KB Output is correct
48 Correct 1 ms 348 KB Output is correct
49 Correct 1 ms 348 KB Output is correct
50 Correct 1 ms 348 KB Output is correct
51 Correct 1 ms 348 KB Output is correct
52 Correct 1 ms 348 KB Output is correct
53 Correct 1 ms 1116 KB Output is correct
54 Correct 1 ms 1116 KB Output is correct
55 Correct 1 ms 1116 KB Output is correct
56 Correct 1 ms 1116 KB Output is correct
57 Correct 1 ms 1116 KB Output is correct
58 Correct 1 ms 1116 KB Output is correct
59 Correct 1 ms 1116 KB Output is correct
60 Correct 1 ms 860 KB Output is correct
61 Correct 1 ms 1116 KB Output is correct
62 Correct 1 ms 860 KB Output is correct
63 Correct 1 ms 1116 KB Output is correct
64 Correct 1 ms 860 KB Output is correct
65 Correct 1 ms 604 KB Output is correct
66 Correct 0 ms 348 KB Output is correct
67 Correct 1 ms 604 KB Output is correct
68 Correct 1 ms 604 KB Output is correct
69 Correct 1 ms 604 KB Output is correct
70 Correct 2 ms 1116 KB Output is correct
71 Correct 2 ms 1116 KB Output is correct
72 Correct 1 ms 860 KB Output is correct
73 Correct 1 ms 604 KB Output is correct
74 Correct 2 ms 860 KB Output is correct
75 Correct 2 ms 1116 KB Output is correct
76 Correct 9 ms 2140 KB Output is correct
77 Correct 10 ms 2140 KB Output is correct
78 Correct 11 ms 2396 KB Output is correct
79 Correct 1 ms 888 KB Output is correct
80 Correct 1 ms 860 KB Output is correct
81 Correct 1 ms 860 KB Output is correct
82 Correct 1 ms 860 KB Output is correct
83 Correct 1 ms 860 KB Output is correct
84 Correct 2 ms 1372 KB Output is correct
85 Correct 2 ms 1372 KB Output is correct
86 Correct 2 ms 1368 KB Output is correct
87 Correct 2 ms 1372 KB Output is correct
88 Correct 2 ms 1372 KB Output is correct
89 Correct 2 ms 1372 KB Output is correct
90 Correct 12 ms 2908 KB Output is correct
91 Correct 12 ms 2908 KB Output is correct
92 Correct 13 ms 2960 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 1116 KB Output is correct
16 Correct 1 ms 1116 KB Output is correct
17 Correct 1 ms 1116 KB Output is correct
18 Correct 1 ms 1116 KB Output is correct
19 Correct 1 ms 1116 KB Output is correct
20 Correct 1 ms 1116 KB Output is correct
21 Correct 1 ms 1168 KB Output is correct
22 Correct 1 ms 1368 KB Output is correct
23 Correct 1 ms 1112 KB Output is correct
24 Correct 8 ms 2396 KB Output is correct
25 Correct 8 ms 2268 KB Output is correct
26 Correct 8 ms 2412 KB Output is correct
27 Correct 2 ms 604 KB Output is correct
28 Correct 2 ms 604 KB Output is correct
29 Correct 2 ms 600 KB Output is correct
30 Correct 2 ms 604 KB Output is correct
31 Correct 2 ms 604 KB Output is correct
32 Correct 2 ms 604 KB Output is correct
33 Correct 5 ms 1884 KB Output is correct
34 Correct 4 ms 2136 KB Output is correct
35 Correct 4 ms 1884 KB Output is correct
36 Correct 4 ms 1884 KB Output is correct
37 Correct 4 ms 1884 KB Output is correct
38 Correct 4 ms 1884 KB Output is correct
39 Correct 10 ms 2812 KB Output is correct
40 Correct 10 ms 2908 KB Output is correct
41 Correct 10 ms 2908 KB Output is correct
42 Correct 0 ms 348 KB Output is correct
43 Correct 0 ms 348 KB Output is correct
44 Correct 1 ms 348 KB Output is correct
45 Correct 1 ms 348 KB Output is correct
46 Correct 0 ms 348 KB Output is correct
47 Correct 0 ms 348 KB Output is correct
48 Correct 0 ms 348 KB Output is correct
49 Correct 0 ms 348 KB Output is correct
50 Correct 0 ms 348 KB Output is correct
51 Correct 1 ms 860 KB Output is correct
52 Correct 1 ms 856 KB Output is correct
53 Correct 1 ms 600 KB Output is correct
54 Correct 1 ms 856 KB Output is correct
55 Correct 1 ms 860 KB Output is correct
56 Correct 1 ms 604 KB Output is correct
57 Correct 0 ms 348 KB Output is correct
58 Correct 1 ms 860 KB Output is correct
59 Correct 1 ms 604 KB Output is correct
60 Correct 1 ms 856 KB Output is correct
61 Correct 1 ms 860 KB Output is correct
62 Correct 0 ms 348 KB Output is correct
63 Correct 1 ms 348 KB Output is correct
64 Correct 1 ms 348 KB Output is correct
65 Correct 1 ms 348 KB Output is correct
66 Correct 1 ms 348 KB Output is correct
67 Correct 1 ms 348 KB Output is correct
68 Correct 1 ms 1116 KB Output is correct
69 Correct 1 ms 1116 KB Output is correct
70 Correct 1 ms 1116 KB Output is correct
71 Correct 1 ms 1116 KB Output is correct
72 Correct 1 ms 1116 KB Output is correct
73 Correct 1 ms 1116 KB Output is correct
74 Correct 1 ms 1116 KB Output is correct
75 Correct 1 ms 860 KB Output is correct
76 Correct 1 ms 1116 KB Output is correct
77 Correct 1 ms 860 KB Output is correct
78 Correct 1 ms 1116 KB Output is correct
79 Correct 1 ms 860 KB Output is correct
80 Correct 1 ms 604 KB Output is correct
81 Correct 0 ms 348 KB Output is correct
82 Correct 1 ms 604 KB Output is correct
83 Correct 1 ms 604 KB Output is correct
84 Correct 1 ms 604 KB Output is correct
85 Correct 2 ms 1116 KB Output is correct
86 Correct 2 ms 1116 KB Output is correct
87 Correct 1 ms 860 KB Output is correct
88 Correct 1 ms 604 KB Output is correct
89 Correct 2 ms 860 KB Output is correct
90 Correct 2 ms 1116 KB Output is correct
91 Correct 9 ms 2140 KB Output is correct
92 Correct 10 ms 2140 KB Output is correct
93 Correct 11 ms 2396 KB Output is correct
94 Correct 1 ms 888 KB Output is correct
95 Correct 1 ms 860 KB Output is correct
96 Correct 1 ms 860 KB Output is correct
97 Correct 1 ms 860 KB Output is correct
98 Correct 1 ms 860 KB Output is correct
99 Correct 2 ms 1372 KB Output is correct
100 Correct 2 ms 1372 KB Output is correct
101 Correct 2 ms 1368 KB Output is correct
102 Correct 2 ms 1372 KB Output is correct
103 Correct 2 ms 1372 KB Output is correct
104 Correct 2 ms 1372 KB Output is correct
105 Correct 12 ms 2908 KB Output is correct
106 Correct 12 ms 2908 KB Output is correct
107 Correct 13 ms 2960 KB Output is correct
108 Correct 2 ms 860 KB Output is correct
109 Correct 82 ms 36884 KB Output is correct
110 Correct 74 ms 32604 KB Output is correct
111 Correct 65 ms 32088 KB Output is correct
112 Correct 90 ms 46060 KB Output is correct
113 Correct 69 ms 42012 KB Output is correct
114 Correct 43 ms 46416 KB Output is correct
115 Correct 10 ms 4444 KB Output is correct
116 Correct 57 ms 55296 KB Output is correct
117 Correct 32 ms 31892 KB Output is correct
118 Correct 11 ms 6236 KB Output is correct
119 Correct 82 ms 88348 KB Output is correct
120 Correct 79 ms 95784 KB Output is correct
121 Correct 72 ms 94552 KB Output is correct
122 Correct 39 ms 28252 KB Output is correct
123 Correct 23 ms 26968 KB Output is correct
124 Correct 21 ms 14016 KB Output is correct
125 Correct 14 ms 12744 KB Output is correct
126 Correct 5 ms 2140 KB Output is correct
127 Correct 36 ms 41504 KB Output is correct
128 Correct 10 ms 8284 KB Output is correct
129 Correct 13 ms 11864 KB Output is correct
130 Correct 3 ms 860 KB Output is correct
131 Correct 111 ms 51788 KB Output is correct
132 Correct 154 ms 65616 KB Output is correct
133 Correct 147 ms 73872 KB Output is correct
134 Correct 144 ms 80592 KB Output is correct
135 Correct 142 ms 86616 KB Output is correct
136 Correct 140 ms 163920 KB Output is correct
137 Correct 151 ms 163708 KB Output is correct
138 Correct 135 ms 163920 KB Output is correct
139 Correct 134 ms 163704 KB Output is correct
140 Correct 136 ms 163664 KB Output is correct
141 Correct 136 ms 163676 KB Output is correct
142 Correct 141 ms 164592 KB Output is correct
143 Correct 127 ms 162632 KB Output is correct
144 Correct 135 ms 164440 KB Output is correct
145 Correct 124 ms 162652 KB Output is correct
146 Correct 135 ms 164436 KB Output is correct
147 Correct 127 ms 162648 KB Output is correct
148 Correct 123 ms 163064 KB Output is correct
149 Correct 68 ms 82268 KB Output is correct
150 Correct 47 ms 55128 KB Output is correct
151 Correct 41 ms 41824 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 1116 KB Output is correct
16 Correct 1 ms 1116 KB Output is correct
17 Correct 1 ms 1116 KB Output is correct
18 Correct 1 ms 1116 KB Output is correct
19 Correct 1 ms 1116 KB Output is correct
20 Correct 1 ms 1116 KB Output is correct
21 Correct 1 ms 1168 KB Output is correct
22 Correct 1 ms 1368 KB Output is correct
23 Correct 1 ms 1112 KB Output is correct
24 Correct 8 ms 2396 KB Output is correct
25 Correct 8 ms 2268 KB Output is correct
26 Correct 8 ms 2412 KB Output is correct
27 Correct 2 ms 604 KB Output is correct
28 Correct 2 ms 604 KB Output is correct
29 Correct 2 ms 600 KB Output is correct
30 Correct 2 ms 604 KB Output is correct
31 Correct 2 ms 604 KB Output is correct
32 Correct 2 ms 604 KB Output is correct
33 Correct 5 ms 1884 KB Output is correct
34 Correct 4 ms 2136 KB Output is correct
35 Correct 4 ms 1884 KB Output is correct
36 Correct 4 ms 1884 KB Output is correct
37 Correct 4 ms 1884 KB Output is correct
38 Correct 4 ms 1884 KB Output is correct
39 Correct 10 ms 2812 KB Output is correct
40 Correct 10 ms 2908 KB Output is correct
41 Correct 10 ms 2908 KB Output is correct
42 Correct 6 ms 1628 KB Output is correct
43 Correct 4 ms 1180 KB Output is correct
44 Correct 7 ms 2136 KB Output is correct
45 Correct 5 ms 1372 KB Output is correct
46 Correct 4 ms 1372 KB Output is correct
47 Correct 7 ms 1864 KB Output is correct
48 Correct 26 ms 11120 KB Output is correct
49 Correct 21 ms 6220 KB Output is correct
50 Correct 23 ms 10036 KB Output is correct
51 Correct 23 ms 8796 KB Output is correct
52 Correct 22 ms 8028 KB Output is correct
53 Correct 20 ms 5468 KB Output is correct
54 Correct 7 ms 1964 KB Output is correct
55 Correct 7 ms 1884 KB Output is correct
56 Correct 7 ms 1880 KB Output is correct
57 Correct 7 ms 1880 KB Output is correct
58 Correct 7 ms 1884 KB Output is correct
59 Correct 7 ms 1884 KB Output is correct
60 Correct 29 ms 11348 KB Output is correct
61 Correct 30 ms 11608 KB Output is correct
62 Correct 28 ms 11756 KB Output is correct
63 Correct 28 ms 11560 KB Output is correct
64 Correct 28 ms 11344 KB Output is correct
65 Correct 28 ms 11612 KB Output is correct
66 Correct 28 ms 10328 KB Output is correct
67 Correct 29 ms 10588 KB Output is correct
68 Correct 27 ms 10352 KB Output is correct
69 Correct 0 ms 348 KB Output is correct
70 Correct 0 ms 348 KB Output is correct
71 Correct 1 ms 348 KB Output is correct
72 Correct 1 ms 348 KB Output is correct
73 Correct 0 ms 348 KB Output is correct
74 Correct 0 ms 348 KB Output is correct
75 Correct 0 ms 348 KB Output is correct
76 Correct 0 ms 348 KB Output is correct
77 Correct 0 ms 348 KB Output is correct
78 Correct 1 ms 860 KB Output is correct
79 Correct 1 ms 856 KB Output is correct
80 Correct 1 ms 600 KB Output is correct
81 Correct 1 ms 856 KB Output is correct
82 Correct 1 ms 860 KB Output is correct
83 Correct 1 ms 604 KB Output is correct
84 Correct 0 ms 348 KB Output is correct
85 Correct 1 ms 860 KB Output is correct
86 Correct 1 ms 604 KB Output is correct
87 Correct 1 ms 856 KB Output is correct
88 Correct 1 ms 860 KB Output is correct
89 Correct 0 ms 348 KB Output is correct
90 Correct 1 ms 348 KB Output is correct
91 Correct 1 ms 348 KB Output is correct
92 Correct 1 ms 348 KB Output is correct
93 Correct 1 ms 348 KB Output is correct
94 Correct 1 ms 348 KB Output is correct
95 Correct 1 ms 1116 KB Output is correct
96 Correct 1 ms 1116 KB Output is correct
97 Correct 1 ms 1116 KB Output is correct
98 Correct 1 ms 1116 KB Output is correct
99 Correct 1 ms 1116 KB Output is correct
100 Correct 1 ms 1116 KB Output is correct
101 Correct 1 ms 1116 KB Output is correct
102 Correct 1 ms 860 KB Output is correct
103 Correct 1 ms 1116 KB Output is correct
104 Correct 1 ms 860 KB Output is correct
105 Correct 1 ms 1116 KB Output is correct
106 Correct 1 ms 860 KB Output is correct
107 Correct 1 ms 604 KB Output is correct
108 Correct 0 ms 348 KB Output is correct
109 Correct 1 ms 604 KB Output is correct
110 Correct 1 ms 604 KB Output is correct
111 Correct 1 ms 604 KB Output is correct
112 Correct 2 ms 1116 KB Output is correct
113 Correct 2 ms 1116 KB Output is correct
114 Correct 1 ms 860 KB Output is correct
115 Correct 1 ms 604 KB Output is correct
116 Correct 2 ms 860 KB Output is correct
117 Correct 2 ms 1116 KB Output is correct
118 Correct 9 ms 2140 KB Output is correct
119 Correct 10 ms 2140 KB Output is correct
120 Correct 11 ms 2396 KB Output is correct
121 Correct 1 ms 888 KB Output is correct
122 Correct 1 ms 860 KB Output is correct
123 Correct 1 ms 860 KB Output is correct
124 Correct 1 ms 860 KB Output is correct
125 Correct 1 ms 860 KB Output is correct
126 Correct 2 ms 1372 KB Output is correct
127 Correct 2 ms 1372 KB Output is correct
128 Correct 2 ms 1368 KB Output is correct
129 Correct 2 ms 1372 KB Output is correct
130 Correct 2 ms 1372 KB Output is correct
131 Correct 2 ms 1372 KB Output is correct
132 Correct 12 ms 2908 KB Output is correct
133 Correct 12 ms 2908 KB Output is correct
134 Correct 13 ms 2960 KB Output is correct
135 Correct 2 ms 860 KB Output is correct
136 Correct 82 ms 36884 KB Output is correct
137 Correct 74 ms 32604 KB Output is correct
138 Correct 65 ms 32088 KB Output is correct
139 Correct 90 ms 46060 KB Output is correct
140 Correct 69 ms 42012 KB Output is correct
141 Correct 43 ms 46416 KB Output is correct
142 Correct 10 ms 4444 KB Output is correct
143 Correct 57 ms 55296 KB Output is correct
144 Correct 32 ms 31892 KB Output is correct
145 Correct 11 ms 6236 KB Output is correct
146 Correct 82 ms 88348 KB Output is correct
147 Correct 79 ms 95784 KB Output is correct
148 Correct 72 ms 94552 KB Output is correct
149 Correct 39 ms 28252 KB Output is correct
150 Correct 23 ms 26968 KB Output is correct
151 Correct 21 ms 14016 KB Output is correct
152 Correct 14 ms 12744 KB Output is correct
153 Correct 5 ms 2140 KB Output is correct
154 Correct 36 ms 41504 KB Output is correct
155 Correct 10 ms 8284 KB Output is correct
156 Correct 13 ms 11864 KB Output is correct
157 Correct 3 ms 860 KB Output is correct
158 Correct 111 ms 51788 KB Output is correct
159 Correct 154 ms 65616 KB Output is correct
160 Correct 147 ms 73872 KB Output is correct
161 Correct 144 ms 80592 KB Output is correct
162 Correct 142 ms 86616 KB Output is correct
163 Correct 140 ms 163920 KB Output is correct
164 Correct 151 ms 163708 KB Output is correct
165 Correct 135 ms 163920 KB Output is correct
166 Correct 134 ms 163704 KB Output is correct
167 Correct 136 ms 163664 KB Output is correct
168 Correct 136 ms 163676 KB Output is correct
169 Correct 141 ms 164592 KB Output is correct
170 Correct 127 ms 162632 KB Output is correct
171 Correct 135 ms 164440 KB Output is correct
172 Correct 124 ms 162652 KB Output is correct
173 Correct 135 ms 164436 KB Output is correct
174 Correct 127 ms 162648 KB Output is correct
175 Correct 123 ms 163064 KB Output is correct
176 Correct 68 ms 82268 KB Output is correct
177 Correct 47 ms 55128 KB Output is correct
178 Correct 41 ms 41824 KB Output is correct
179 Correct 6 ms 2140 KB Output is correct
180 Correct 189 ms 103508 KB Output is correct
181 Correct 532 ms 225716 KB Output is correct
182 Correct 753 ms 374700 KB Output is correct
183 Correct 465 ms 284732 KB Output is correct
184 Correct 421 ms 284536 KB Output is correct
185 Runtime error 80 ms 524288 KB Execution killed with signal 9
186 Halted 0 ms 0 KB -