Submission #576655

# Submission time Handle Problem Language Result Execution time Memory
576655 2022-06-13T08:56:13 Z pnm1384 Painting Walls (APIO20_paint) C++14
100 / 100
764 ms 18656 KB
#include "paint.h"
#include<bits/stdc++.h>
using namespace std;

#define F first
#define S second

const int N = 3e5 + 20;
vector<int> vt[N];
int col[N], last[N], dp[N];
bool have[N];
vector<pair<int, int>> vt1, vt2;

int minimumInstructions(int N, int M, int K, std::vector<int> C, std::vector<int> A, std::vector<std::vector<int>> B) 
{
	int n = N, m = M, k = K;
	for (int i = 0; i < n; i++)
	{
		col[i] = C[i];
	}
	for (int i = 0; i < m; i++)
	{
		for (int j = 0; j < A[i]; j++)
		{
			int c = B[i][j];
			vt[c].push_back(i);
		}
	}
	for (int i = 0; i < m; i++)
	{
		last[i] = -2;
		dp[i] = -2;
	}
	for (int i = 0; i < n; i++)
	{
		vt1.clear(); vt2.clear();
		for (int j : vt[col[i]])
		{
			int j2 = j - 1;
			if (j2 < 0) j2 = m - 1;
			if (last[j2] == i - 1)
			{
				vt1.push_back({j, min(dp[j2] + 1, m)});
			}
			else
			{
				vt2.push_back({j, 1});
			}
		}
		for (pair<int, int> pppp : vt1)
		{
			int j = pppp.F;
			dp[j] = pppp.S;
			assert(dp[j] <= i + 1);
			last[j] = i;
		}
		for (pair<int, int> pppp : vt2)
		{
			int j = pppp.F;
			dp[j] = 1;
			last[j] = i;
		}
		for (int j : vt[col[i]])
		{
			if (dp[j] == m) 
			{
				have[i - m + 1] = true;
				//assert(i - m + 1 >= 0);
			}
		}
	}
	int i = 0, j = 0;
	int ans = 0;
	while (i < n)
	{
		int ff = -1;
		for (int kk = i; kk >= j; kk--)
		{
			if (have[kk])
			{
				ff = kk;
				break;
			}
		}
		if (ff == -1) return -1;
		ans++;
		j = i + 1;
		i = m + ff;
	}
	return ans;
}

Compilation message

paint.cpp: In function 'int minimumInstructions(int, int, int, std::vector<int>, std::vector<int>, std::vector<std::vector<int> >)':
paint.cpp:16:20: warning: unused variable 'k' [-Wunused-variable]
   16 |  int n = N, m = M, k = K;
      |                    ^
# Verdict Execution time Memory Grader output
1 Correct 5 ms 7252 KB Output is correct
2 Correct 5 ms 7352 KB Output is correct
3 Correct 5 ms 7380 KB Output is correct
4 Correct 4 ms 7380 KB Output is correct
5 Correct 4 ms 7356 KB Output is correct
6 Correct 4 ms 7356 KB Output is correct
7 Correct 6 ms 7356 KB Output is correct
8 Correct 5 ms 7304 KB Output is correct
9 Correct 4 ms 7380 KB Output is correct
10 Correct 4 ms 7380 KB Output is correct
11 Correct 4 ms 7352 KB Output is correct
12 Correct 4 ms 7360 KB Output is correct
13 Correct 5 ms 7380 KB Output is correct
14 Correct 5 ms 7356 KB Output is correct
15 Correct 5 ms 7328 KB Output is correct
16 Correct 5 ms 7380 KB Output is correct
17 Correct 4 ms 7360 KB Output is correct
18 Correct 4 ms 7380 KB Output is correct
19 Correct 5 ms 7380 KB Output is correct
20 Correct 4 ms 7380 KB Output is correct
21 Correct 5 ms 7380 KB Output is correct
22 Correct 23 ms 11552 KB Output is correct
23 Correct 25 ms 11612 KB Output is correct
24 Correct 24 ms 11596 KB Output is correct
25 Correct 6 ms 7636 KB Output is correct
26 Correct 8 ms 7620 KB Output is correct
27 Correct 8 ms 7636 KB Output is correct
28 Correct 6 ms 7636 KB Output is correct
29 Correct 8 ms 7636 KB Output is correct
30 Correct 6 ms 7636 KB Output is correct
31 Correct 12 ms 8692 KB Output is correct
32 Correct 11 ms 8788 KB Output is correct
33 Correct 12 ms 8696 KB Output is correct
34 Correct 12 ms 8784 KB Output is correct
35 Correct 12 ms 8780 KB Output is correct
36 Correct 12 ms 8680 KB Output is correct
37 Correct 27 ms 11916 KB Output is correct
38 Correct 38 ms 11972 KB Output is correct
39 Correct 33 ms 11976 KB Output is correct
40 Correct 15 ms 8600 KB Output is correct
41 Correct 10 ms 8208 KB Output is correct
42 Correct 16 ms 8720 KB Output is correct
43 Correct 16 ms 8288 KB Output is correct
44 Correct 10 ms 8148 KB Output is correct
45 Correct 14 ms 8788 KB Output is correct
46 Correct 46 ms 17444 KB Output is correct
47 Correct 28 ms 13044 KB Output is correct
48 Correct 33 ms 15804 KB Output is correct
49 Correct 42 ms 15824 KB Output is correct
50 Correct 41 ms 15512 KB Output is correct
51 Correct 35 ms 13172 KB Output is correct
52 Correct 15 ms 8776 KB Output is correct
53 Correct 14 ms 8788 KB Output is correct
54 Correct 16 ms 8844 KB Output is correct
55 Correct 17 ms 8720 KB Output is correct
56 Correct 15 ms 8788 KB Output is correct
57 Correct 14 ms 8776 KB Output is correct
58 Correct 47 ms 18196 KB Output is correct
59 Correct 48 ms 18260 KB Output is correct
60 Correct 47 ms 18256 KB Output is correct
61 Correct 50 ms 18204 KB Output is correct
62 Correct 47 ms 18296 KB Output is correct
63 Correct 48 ms 18184 KB Output is correct
64 Correct 53 ms 17312 KB Output is correct
65 Correct 52 ms 17392 KB Output is correct
66 Correct 56 ms 17336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 7252 KB Output is correct
2 Correct 5 ms 7352 KB Output is correct
3 Correct 5 ms 7380 KB Output is correct
4 Correct 4 ms 7380 KB Output is correct
5 Correct 4 ms 7356 KB Output is correct
6 Correct 4 ms 7356 KB Output is correct
7 Correct 6 ms 7356 KB Output is correct
8 Correct 5 ms 7304 KB Output is correct
9 Correct 4 ms 7380 KB Output is correct
10 Correct 4 ms 7380 KB Output is correct
11 Correct 4 ms 7352 KB Output is correct
12 Correct 4 ms 7360 KB Output is correct
13 Correct 5 ms 7380 KB Output is correct
14 Correct 5 ms 7356 KB Output is correct
15 Correct 5 ms 7328 KB Output is correct
16 Correct 5 ms 7380 KB Output is correct
17 Correct 4 ms 7360 KB Output is correct
18 Correct 4 ms 7380 KB Output is correct
19 Correct 5 ms 7380 KB Output is correct
20 Correct 4 ms 7380 KB Output is correct
21 Correct 5 ms 7380 KB Output is correct
22 Correct 4 ms 7252 KB Output is correct
23 Correct 4 ms 7252 KB Output is correct
24 Correct 4 ms 7252 KB Output is correct
25 Correct 4 ms 7252 KB Output is correct
26 Correct 4 ms 7356 KB Output is correct
27 Correct 4 ms 7380 KB Output is correct
28 Correct 4 ms 7356 KB Output is correct
29 Correct 4 ms 7380 KB Output is correct
30 Correct 4 ms 7280 KB Output is correct
31 Correct 4 ms 7356 KB Output is correct
32 Correct 4 ms 7380 KB Output is correct
33 Correct 4 ms 7380 KB Output is correct
34 Correct 6 ms 7380 KB Output is correct
35 Correct 4 ms 7352 KB Output is correct
36 Correct 5 ms 7360 KB Output is correct
37 Correct 4 ms 7356 KB Output is correct
38 Correct 4 ms 7380 KB Output is correct
39 Correct 4 ms 7380 KB Output is correct
40 Correct 5 ms 7380 KB Output is correct
41 Correct 4 ms 7380 KB Output is correct
42 Correct 4 ms 7380 KB Output is correct
43 Correct 4 ms 7380 KB Output is correct
44 Correct 4 ms 7356 KB Output is correct
45 Correct 4 ms 7328 KB Output is correct
46 Correct 5 ms 7352 KB Output is correct
47 Correct 5 ms 7380 KB Output is correct
48 Correct 4 ms 7380 KB Output is correct
49 Correct 4 ms 7380 KB Output is correct
50 Correct 4 ms 7360 KB Output is correct
51 Correct 4 ms 7380 KB Output is correct
52 Correct 4 ms 7380 KB Output is correct
53 Correct 4 ms 7380 KB Output is correct
54 Correct 4 ms 7380 KB Output is correct
55 Correct 4 ms 7368 KB Output is correct
56 Correct 5 ms 7368 KB Output is correct
57 Correct 4 ms 7380 KB Output is correct
58 Correct 5 ms 7356 KB Output is correct
59 Correct 4 ms 7356 KB Output is correct
60 Correct 4 ms 7364 KB Output is correct
61 Correct 5 ms 7360 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 7252 KB Output is correct
2 Correct 4 ms 7252 KB Output is correct
3 Correct 5 ms 7252 KB Output is correct
4 Correct 5 ms 7352 KB Output is correct
5 Correct 5 ms 7380 KB Output is correct
6 Correct 4 ms 7380 KB Output is correct
7 Correct 4 ms 7356 KB Output is correct
8 Correct 4 ms 7356 KB Output is correct
9 Correct 6 ms 7356 KB Output is correct
10 Correct 5 ms 7304 KB Output is correct
11 Correct 4 ms 7380 KB Output is correct
12 Correct 4 ms 7380 KB Output is correct
13 Correct 4 ms 7352 KB Output is correct
14 Correct 4 ms 7360 KB Output is correct
15 Correct 5 ms 7380 KB Output is correct
16 Correct 5 ms 7356 KB Output is correct
17 Correct 5 ms 7328 KB Output is correct
18 Correct 5 ms 7380 KB Output is correct
19 Correct 4 ms 7360 KB Output is correct
20 Correct 4 ms 7380 KB Output is correct
21 Correct 5 ms 7380 KB Output is correct
22 Correct 4 ms 7380 KB Output is correct
23 Correct 5 ms 7380 KB Output is correct
24 Correct 23 ms 11552 KB Output is correct
25 Correct 25 ms 11612 KB Output is correct
26 Correct 24 ms 11596 KB Output is correct
27 Correct 4 ms 7252 KB Output is correct
28 Correct 4 ms 7252 KB Output is correct
29 Correct 4 ms 7356 KB Output is correct
30 Correct 4 ms 7380 KB Output is correct
31 Correct 4 ms 7356 KB Output is correct
32 Correct 4 ms 7380 KB Output is correct
33 Correct 4 ms 7280 KB Output is correct
34 Correct 4 ms 7356 KB Output is correct
35 Correct 4 ms 7380 KB Output is correct
36 Correct 4 ms 7380 KB Output is correct
37 Correct 6 ms 7380 KB Output is correct
38 Correct 4 ms 7352 KB Output is correct
39 Correct 5 ms 7360 KB Output is correct
40 Correct 4 ms 7356 KB Output is correct
41 Correct 4 ms 7380 KB Output is correct
42 Correct 4 ms 7380 KB Output is correct
43 Correct 5 ms 7380 KB Output is correct
44 Correct 4 ms 7380 KB Output is correct
45 Correct 4 ms 7380 KB Output is correct
46 Correct 4 ms 7380 KB Output is correct
47 Correct 4 ms 7356 KB Output is correct
48 Correct 4 ms 7328 KB Output is correct
49 Correct 5 ms 7352 KB Output is correct
50 Correct 5 ms 7380 KB Output is correct
51 Correct 4 ms 7380 KB Output is correct
52 Correct 4 ms 7380 KB Output is correct
53 Correct 4 ms 7360 KB Output is correct
54 Correct 4 ms 7380 KB Output is correct
55 Correct 4 ms 7380 KB Output is correct
56 Correct 4 ms 7380 KB Output is correct
57 Correct 4 ms 7380 KB Output is correct
58 Correct 4 ms 7368 KB Output is correct
59 Correct 5 ms 7368 KB Output is correct
60 Correct 4 ms 7380 KB Output is correct
61 Correct 5 ms 7356 KB Output is correct
62 Correct 4 ms 7356 KB Output is correct
63 Correct 4 ms 7364 KB Output is correct
64 Correct 5 ms 7360 KB Output is correct
65 Correct 5 ms 7380 KB Output is correct
66 Correct 5 ms 7380 KB Output is correct
67 Correct 5 ms 7380 KB Output is correct
68 Correct 5 ms 7380 KB Output is correct
69 Correct 5 ms 7356 KB Output is correct
70 Correct 6 ms 7624 KB Output is correct
71 Correct 6 ms 7564 KB Output is correct
72 Correct 6 ms 7508 KB Output is correct
73 Correct 5 ms 7508 KB Output is correct
74 Correct 6 ms 7508 KB Output is correct
75 Correct 6 ms 7508 KB Output is correct
76 Correct 23 ms 10572 KB Output is correct
77 Correct 20 ms 10948 KB Output is correct
78 Correct 27 ms 11324 KB Output is correct
79 Correct 5 ms 7380 KB Output is correct
80 Correct 6 ms 7352 KB Output is correct
81 Correct 6 ms 7356 KB Output is correct
82 Correct 6 ms 7380 KB Output is correct
83 Correct 6 ms 7356 KB Output is correct
84 Correct 6 ms 7636 KB Output is correct
85 Correct 7 ms 7636 KB Output is correct
86 Correct 6 ms 7624 KB Output is correct
87 Correct 6 ms 7624 KB Output is correct
88 Correct 6 ms 7588 KB Output is correct
89 Correct 7 ms 7636 KB Output is correct
90 Correct 32 ms 11628 KB Output is correct
91 Correct 37 ms 11656 KB Output is correct
92 Correct 35 ms 11580 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 7252 KB Output is correct
2 Correct 4 ms 7252 KB Output is correct
3 Correct 5 ms 7252 KB Output is correct
4 Correct 5 ms 7352 KB Output is correct
5 Correct 5 ms 7380 KB Output is correct
6 Correct 4 ms 7380 KB Output is correct
7 Correct 4 ms 7356 KB Output is correct
8 Correct 4 ms 7356 KB Output is correct
9 Correct 6 ms 7356 KB Output is correct
10 Correct 5 ms 7304 KB Output is correct
11 Correct 4 ms 7380 KB Output is correct
12 Correct 4 ms 7380 KB Output is correct
13 Correct 4 ms 7352 KB Output is correct
14 Correct 4 ms 7360 KB Output is correct
15 Correct 5 ms 7380 KB Output is correct
16 Correct 5 ms 7356 KB Output is correct
17 Correct 5 ms 7328 KB Output is correct
18 Correct 5 ms 7380 KB Output is correct
19 Correct 4 ms 7360 KB Output is correct
20 Correct 4 ms 7380 KB Output is correct
21 Correct 5 ms 7380 KB Output is correct
22 Correct 4 ms 7380 KB Output is correct
23 Correct 5 ms 7380 KB Output is correct
24 Correct 23 ms 11552 KB Output is correct
25 Correct 25 ms 11612 KB Output is correct
26 Correct 24 ms 11596 KB Output is correct
27 Correct 6 ms 7636 KB Output is correct
28 Correct 8 ms 7620 KB Output is correct
29 Correct 8 ms 7636 KB Output is correct
30 Correct 6 ms 7636 KB Output is correct
31 Correct 8 ms 7636 KB Output is correct
32 Correct 6 ms 7636 KB Output is correct
33 Correct 12 ms 8692 KB Output is correct
34 Correct 11 ms 8788 KB Output is correct
35 Correct 12 ms 8696 KB Output is correct
36 Correct 12 ms 8784 KB Output is correct
37 Correct 12 ms 8780 KB Output is correct
38 Correct 12 ms 8680 KB Output is correct
39 Correct 27 ms 11916 KB Output is correct
40 Correct 38 ms 11972 KB Output is correct
41 Correct 33 ms 11976 KB Output is correct
42 Correct 4 ms 7252 KB Output is correct
43 Correct 4 ms 7252 KB Output is correct
44 Correct 4 ms 7356 KB Output is correct
45 Correct 4 ms 7380 KB Output is correct
46 Correct 4 ms 7356 KB Output is correct
47 Correct 4 ms 7380 KB Output is correct
48 Correct 4 ms 7280 KB Output is correct
49 Correct 4 ms 7356 KB Output is correct
50 Correct 4 ms 7380 KB Output is correct
51 Correct 4 ms 7380 KB Output is correct
52 Correct 6 ms 7380 KB Output is correct
53 Correct 4 ms 7352 KB Output is correct
54 Correct 5 ms 7360 KB Output is correct
55 Correct 4 ms 7356 KB Output is correct
56 Correct 4 ms 7380 KB Output is correct
57 Correct 4 ms 7380 KB Output is correct
58 Correct 5 ms 7380 KB Output is correct
59 Correct 4 ms 7380 KB Output is correct
60 Correct 4 ms 7380 KB Output is correct
61 Correct 4 ms 7380 KB Output is correct
62 Correct 4 ms 7356 KB Output is correct
63 Correct 4 ms 7328 KB Output is correct
64 Correct 5 ms 7352 KB Output is correct
65 Correct 5 ms 7380 KB Output is correct
66 Correct 4 ms 7380 KB Output is correct
67 Correct 4 ms 7380 KB Output is correct
68 Correct 4 ms 7360 KB Output is correct
69 Correct 4 ms 7380 KB Output is correct
70 Correct 4 ms 7380 KB Output is correct
71 Correct 4 ms 7380 KB Output is correct
72 Correct 4 ms 7380 KB Output is correct
73 Correct 4 ms 7368 KB Output is correct
74 Correct 5 ms 7368 KB Output is correct
75 Correct 4 ms 7380 KB Output is correct
76 Correct 5 ms 7356 KB Output is correct
77 Correct 4 ms 7356 KB Output is correct
78 Correct 4 ms 7364 KB Output is correct
79 Correct 5 ms 7360 KB Output is correct
80 Correct 5 ms 7380 KB Output is correct
81 Correct 5 ms 7380 KB Output is correct
82 Correct 5 ms 7380 KB Output is correct
83 Correct 5 ms 7380 KB Output is correct
84 Correct 5 ms 7356 KB Output is correct
85 Correct 6 ms 7624 KB Output is correct
86 Correct 6 ms 7564 KB Output is correct
87 Correct 6 ms 7508 KB Output is correct
88 Correct 5 ms 7508 KB Output is correct
89 Correct 6 ms 7508 KB Output is correct
90 Correct 6 ms 7508 KB Output is correct
91 Correct 23 ms 10572 KB Output is correct
92 Correct 20 ms 10948 KB Output is correct
93 Correct 27 ms 11324 KB Output is correct
94 Correct 5 ms 7380 KB Output is correct
95 Correct 6 ms 7352 KB Output is correct
96 Correct 6 ms 7356 KB Output is correct
97 Correct 6 ms 7380 KB Output is correct
98 Correct 6 ms 7356 KB Output is correct
99 Correct 6 ms 7636 KB Output is correct
100 Correct 7 ms 7636 KB Output is correct
101 Correct 6 ms 7624 KB Output is correct
102 Correct 6 ms 7624 KB Output is correct
103 Correct 6 ms 7588 KB Output is correct
104 Correct 7 ms 7636 KB Output is correct
105 Correct 32 ms 11628 KB Output is correct
106 Correct 37 ms 11656 KB Output is correct
107 Correct 35 ms 11580 KB Output is correct
108 Correct 7 ms 7636 KB Output is correct
109 Correct 114 ms 7668 KB Output is correct
110 Correct 67 ms 7620 KB Output is correct
111 Correct 52 ms 7628 KB Output is correct
112 Correct 56 ms 7676 KB Output is correct
113 Correct 39 ms 7636 KB Output is correct
114 Correct 16 ms 9044 KB Output is correct
115 Correct 15 ms 8916 KB Output is correct
116 Correct 19 ms 9292 KB Output is correct
117 Correct 15 ms 9028 KB Output is correct
118 Correct 16 ms 9128 KB Output is correct
119 Correct 13 ms 8788 KB Output is correct
120 Correct 23 ms 10444 KB Output is correct
121 Correct 8 ms 8024 KB Output is correct
122 Correct 26 ms 10572 KB Output is correct
123 Correct 8 ms 7884 KB Output is correct
124 Correct 26 ms 11064 KB Output is correct
125 Correct 11 ms 8304 KB Output is correct
126 Correct 11 ms 8320 KB Output is correct
127 Correct 13 ms 8660 KB Output is correct
128 Correct 10 ms 8260 KB Output is correct
129 Correct 10 ms 8276 KB Output is correct
130 Correct 6 ms 7604 KB Output is correct
131 Correct 159 ms 7760 KB Output is correct
132 Correct 116 ms 7636 KB Output is correct
133 Correct 94 ms 7764 KB Output is correct
134 Correct 84 ms 7748 KB Output is correct
135 Correct 76 ms 7884 KB Output is correct
136 Correct 21 ms 9292 KB Output is correct
137 Correct 21 ms 9272 KB Output is correct
138 Correct 22 ms 9376 KB Output is correct
139 Correct 23 ms 9292 KB Output is correct
140 Correct 28 ms 9280 KB Output is correct
141 Correct 20 ms 9260 KB Output is correct
142 Correct 36 ms 11756 KB Output is correct
143 Correct 11 ms 8516 KB Output is correct
144 Correct 34 ms 11812 KB Output is correct
145 Correct 11 ms 8532 KB Output is correct
146 Correct 38 ms 11804 KB Output is correct
147 Correct 12 ms 8552 KB Output is correct
148 Correct 13 ms 8968 KB Output is correct
149 Correct 13 ms 8824 KB Output is correct
150 Correct 15 ms 8780 KB Output is correct
151 Correct 12 ms 8772 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 7252 KB Output is correct
2 Correct 4 ms 7252 KB Output is correct
3 Correct 5 ms 7252 KB Output is correct
4 Correct 5 ms 7352 KB Output is correct
5 Correct 5 ms 7380 KB Output is correct
6 Correct 4 ms 7380 KB Output is correct
7 Correct 4 ms 7356 KB Output is correct
8 Correct 4 ms 7356 KB Output is correct
9 Correct 6 ms 7356 KB Output is correct
10 Correct 5 ms 7304 KB Output is correct
11 Correct 4 ms 7380 KB Output is correct
12 Correct 4 ms 7380 KB Output is correct
13 Correct 4 ms 7352 KB Output is correct
14 Correct 4 ms 7360 KB Output is correct
15 Correct 5 ms 7380 KB Output is correct
16 Correct 5 ms 7356 KB Output is correct
17 Correct 5 ms 7328 KB Output is correct
18 Correct 5 ms 7380 KB Output is correct
19 Correct 4 ms 7360 KB Output is correct
20 Correct 4 ms 7380 KB Output is correct
21 Correct 5 ms 7380 KB Output is correct
22 Correct 4 ms 7380 KB Output is correct
23 Correct 5 ms 7380 KB Output is correct
24 Correct 23 ms 11552 KB Output is correct
25 Correct 25 ms 11612 KB Output is correct
26 Correct 24 ms 11596 KB Output is correct
27 Correct 6 ms 7636 KB Output is correct
28 Correct 8 ms 7620 KB Output is correct
29 Correct 8 ms 7636 KB Output is correct
30 Correct 6 ms 7636 KB Output is correct
31 Correct 8 ms 7636 KB Output is correct
32 Correct 6 ms 7636 KB Output is correct
33 Correct 12 ms 8692 KB Output is correct
34 Correct 11 ms 8788 KB Output is correct
35 Correct 12 ms 8696 KB Output is correct
36 Correct 12 ms 8784 KB Output is correct
37 Correct 12 ms 8780 KB Output is correct
38 Correct 12 ms 8680 KB Output is correct
39 Correct 27 ms 11916 KB Output is correct
40 Correct 38 ms 11972 KB Output is correct
41 Correct 33 ms 11976 KB Output is correct
42 Correct 15 ms 8600 KB Output is correct
43 Correct 10 ms 8208 KB Output is correct
44 Correct 16 ms 8720 KB Output is correct
45 Correct 16 ms 8288 KB Output is correct
46 Correct 10 ms 8148 KB Output is correct
47 Correct 14 ms 8788 KB Output is correct
48 Correct 46 ms 17444 KB Output is correct
49 Correct 28 ms 13044 KB Output is correct
50 Correct 33 ms 15804 KB Output is correct
51 Correct 42 ms 15824 KB Output is correct
52 Correct 41 ms 15512 KB Output is correct
53 Correct 35 ms 13172 KB Output is correct
54 Correct 15 ms 8776 KB Output is correct
55 Correct 14 ms 8788 KB Output is correct
56 Correct 16 ms 8844 KB Output is correct
57 Correct 17 ms 8720 KB Output is correct
58 Correct 15 ms 8788 KB Output is correct
59 Correct 14 ms 8776 KB Output is correct
60 Correct 47 ms 18196 KB Output is correct
61 Correct 48 ms 18260 KB Output is correct
62 Correct 47 ms 18256 KB Output is correct
63 Correct 50 ms 18204 KB Output is correct
64 Correct 47 ms 18296 KB Output is correct
65 Correct 48 ms 18184 KB Output is correct
66 Correct 53 ms 17312 KB Output is correct
67 Correct 52 ms 17392 KB Output is correct
68 Correct 56 ms 17336 KB Output is correct
69 Correct 4 ms 7252 KB Output is correct
70 Correct 4 ms 7252 KB Output is correct
71 Correct 4 ms 7356 KB Output is correct
72 Correct 4 ms 7380 KB Output is correct
73 Correct 4 ms 7356 KB Output is correct
74 Correct 4 ms 7380 KB Output is correct
75 Correct 4 ms 7280 KB Output is correct
76 Correct 4 ms 7356 KB Output is correct
77 Correct 4 ms 7380 KB Output is correct
78 Correct 4 ms 7380 KB Output is correct
79 Correct 6 ms 7380 KB Output is correct
80 Correct 4 ms 7352 KB Output is correct
81 Correct 5 ms 7360 KB Output is correct
82 Correct 4 ms 7356 KB Output is correct
83 Correct 4 ms 7380 KB Output is correct
84 Correct 4 ms 7380 KB Output is correct
85 Correct 5 ms 7380 KB Output is correct
86 Correct 4 ms 7380 KB Output is correct
87 Correct 4 ms 7380 KB Output is correct
88 Correct 4 ms 7380 KB Output is correct
89 Correct 4 ms 7356 KB Output is correct
90 Correct 4 ms 7328 KB Output is correct
91 Correct 5 ms 7352 KB Output is correct
92 Correct 5 ms 7380 KB Output is correct
93 Correct 4 ms 7380 KB Output is correct
94 Correct 4 ms 7380 KB Output is correct
95 Correct 4 ms 7360 KB Output is correct
96 Correct 4 ms 7380 KB Output is correct
97 Correct 4 ms 7380 KB Output is correct
98 Correct 4 ms 7380 KB Output is correct
99 Correct 4 ms 7380 KB Output is correct
100 Correct 4 ms 7368 KB Output is correct
101 Correct 5 ms 7368 KB Output is correct
102 Correct 4 ms 7380 KB Output is correct
103 Correct 5 ms 7356 KB Output is correct
104 Correct 4 ms 7356 KB Output is correct
105 Correct 4 ms 7364 KB Output is correct
106 Correct 5 ms 7360 KB Output is correct
107 Correct 5 ms 7380 KB Output is correct
108 Correct 5 ms 7380 KB Output is correct
109 Correct 5 ms 7380 KB Output is correct
110 Correct 5 ms 7380 KB Output is correct
111 Correct 5 ms 7356 KB Output is correct
112 Correct 6 ms 7624 KB Output is correct
113 Correct 6 ms 7564 KB Output is correct
114 Correct 6 ms 7508 KB Output is correct
115 Correct 5 ms 7508 KB Output is correct
116 Correct 6 ms 7508 KB Output is correct
117 Correct 6 ms 7508 KB Output is correct
118 Correct 23 ms 10572 KB Output is correct
119 Correct 20 ms 10948 KB Output is correct
120 Correct 27 ms 11324 KB Output is correct
121 Correct 5 ms 7380 KB Output is correct
122 Correct 6 ms 7352 KB Output is correct
123 Correct 6 ms 7356 KB Output is correct
124 Correct 6 ms 7380 KB Output is correct
125 Correct 6 ms 7356 KB Output is correct
126 Correct 6 ms 7636 KB Output is correct
127 Correct 7 ms 7636 KB Output is correct
128 Correct 6 ms 7624 KB Output is correct
129 Correct 6 ms 7624 KB Output is correct
130 Correct 6 ms 7588 KB Output is correct
131 Correct 7 ms 7636 KB Output is correct
132 Correct 32 ms 11628 KB Output is correct
133 Correct 37 ms 11656 KB Output is correct
134 Correct 35 ms 11580 KB Output is correct
135 Correct 7 ms 7636 KB Output is correct
136 Correct 114 ms 7668 KB Output is correct
137 Correct 67 ms 7620 KB Output is correct
138 Correct 52 ms 7628 KB Output is correct
139 Correct 56 ms 7676 KB Output is correct
140 Correct 39 ms 7636 KB Output is correct
141 Correct 16 ms 9044 KB Output is correct
142 Correct 15 ms 8916 KB Output is correct
143 Correct 19 ms 9292 KB Output is correct
144 Correct 15 ms 9028 KB Output is correct
145 Correct 16 ms 9128 KB Output is correct
146 Correct 13 ms 8788 KB Output is correct
147 Correct 23 ms 10444 KB Output is correct
148 Correct 8 ms 8024 KB Output is correct
149 Correct 26 ms 10572 KB Output is correct
150 Correct 8 ms 7884 KB Output is correct
151 Correct 26 ms 11064 KB Output is correct
152 Correct 11 ms 8304 KB Output is correct
153 Correct 11 ms 8320 KB Output is correct
154 Correct 13 ms 8660 KB Output is correct
155 Correct 10 ms 8260 KB Output is correct
156 Correct 10 ms 8276 KB Output is correct
157 Correct 6 ms 7604 KB Output is correct
158 Correct 159 ms 7760 KB Output is correct
159 Correct 116 ms 7636 KB Output is correct
160 Correct 94 ms 7764 KB Output is correct
161 Correct 84 ms 7748 KB Output is correct
162 Correct 76 ms 7884 KB Output is correct
163 Correct 21 ms 9292 KB Output is correct
164 Correct 21 ms 9272 KB Output is correct
165 Correct 22 ms 9376 KB Output is correct
166 Correct 23 ms 9292 KB Output is correct
167 Correct 28 ms 9280 KB Output is correct
168 Correct 20 ms 9260 KB Output is correct
169 Correct 36 ms 11756 KB Output is correct
170 Correct 11 ms 8516 KB Output is correct
171 Correct 34 ms 11812 KB Output is correct
172 Correct 11 ms 8532 KB Output is correct
173 Correct 38 ms 11804 KB Output is correct
174 Correct 12 ms 8552 KB Output is correct
175 Correct 13 ms 8968 KB Output is correct
176 Correct 13 ms 8824 KB Output is correct
177 Correct 15 ms 8780 KB Output is correct
178 Correct 12 ms 8772 KB Output is correct
179 Correct 11 ms 8252 KB Output is correct
180 Correct 314 ms 8256 KB Output is correct
181 Correct 364 ms 8524 KB Output is correct
182 Correct 440 ms 8860 KB Output is correct
183 Correct 229 ms 8408 KB Output is correct
184 Correct 184 ms 8260 KB Output is correct
185 Correct 29 ms 11468 KB Output is correct
186 Correct 34 ms 13140 KB Output is correct
187 Correct 38 ms 12108 KB Output is correct
188 Correct 36 ms 11712 KB Output is correct
189 Correct 35 ms 11684 KB Output is correct
190 Correct 39 ms 12876 KB Output is correct
191 Correct 38 ms 12652 KB Output is correct
192 Correct 29 ms 11096 KB Output is correct
193 Correct 27 ms 10604 KB Output is correct
194 Correct 16 ms 8848 KB Output is correct
195 Correct 764 ms 8936 KB Output is correct
196 Correct 561 ms 8856 KB Output is correct
197 Correct 458 ms 8908 KB Output is correct
198 Correct 393 ms 8916 KB Output is correct
199 Correct 358 ms 8916 KB Output is correct
200 Correct 66 ms 18524 KB Output is correct
201 Correct 65 ms 18516 KB Output is correct
202 Correct 68 ms 18656 KB Output is correct
203 Correct 63 ms 18496 KB Output is correct
204 Correct 68 ms 18532 KB Output is correct
205 Correct 70 ms 18584 KB Output is correct
206 Correct 61 ms 17696 KB Output is correct
207 Correct 49 ms 17400 KB Output is correct
208 Correct 59 ms 17628 KB Output is correct
209 Correct 55 ms 17368 KB Output is correct
210 Correct 60 ms 17680 KB Output is correct
211 Correct 51 ms 17348 KB Output is correct
212 Correct 57 ms 18512 KB Output is correct
213 Correct 49 ms 15040 KB Output is correct
214 Correct 54 ms 14792 KB Output is correct
215 Correct 54 ms 14688 KB Output is correct