Submission #829382

# Submission time Handle Problem Language Result Execution time Memory
829382 2023-08-18T10:00:17 Z QwertyPi Uplifting Excursion (BOI22_vault) C++14
100 / 100
4097 ms 456232 KB
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("Ofast")
#define int long long

using namespace std;

const int M = 300 + 11;
const int X = M * M;
const int INF = 1LL << 60;
int a[M * 2];
int s[M * 2];

int norm(int x, int m){
	if(x >= 0) return x;
	return (x % m + m) % m;
}

int dp_p[M][X], dp_n[M][X];
void solve(int m, int L, vector<int> a, int dp[M][X]){
	for(int i = 0; i <= m; i++){
		fill(dp[i], dp[i] + X, -INF);
	}
	for(int i = 1; i <= m; i++) s[i] = min(L, s[i - 1] + i * a[i]);

	dp[0][0] = 0;
	for(int i = 1; i <= m; i++){
		for(int j = 0; j <= m * (i - 1); j++){
			int left = norm(s[i] - s[i - 1] + j - a[i] * i, i);
			int right = min(s[i] + j - s[i - 1], m * i);
			int inc = i;
			int delta = ((s[i] - left) - (s[i - 1] - j)) / i;
			for(int k = left; k <= right; k += inc){
				dp[i][k] = max(dp[i][k], dp[i - 1][j] + delta);
				delta--;
			}
		}
	}
}

int32_t main(){
	int m, L; cin >> m >> L;
	for(int i = 0; i <= m * 2; i++) cin >> a[i];
	
	if(L < 0){
		reverse(a, a + m * 2 + 1); L = -L;
	}

	int sum_p = 0, sum_n = 0;
	for(int i = m + 1; i <= m * 2; i++) {
		sum_p += (i - m) * a[i];
	}
	for(int i = m - 1; i >= 0; i--) {
		sum_n += (m - i) * a[i];
	}

	if(sum_p < L){
		cout << "impossible" << endl;
		return 0;
	}

	int lim = min(sum_n, sum_p - L);

	// positive
	vector<int> b_pos {0}, b_neg {0};
	for(int i = 1; i <= m; i++){
		b_pos.push_back(a[m + i]);
		b_neg.push_back(a[m - i]);
	}

	solve(m, lim + L, b_pos, dp_p);
	solve(m, lim, b_neg, dp_n);

	int ans = -INF;
	for(int i = 0; i <= m * m; i++){
		ans = max(ans, dp_p[m][i] + dp_n[m][i]);
	}

	if(ans <= -INF / 2){
		cout << "impossible" << endl;
	}else{
		cout << a[m] + ans << endl;
	}
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4820 KB Output is correct
2 Correct 2 ms 6356 KB Output is correct
3 Correct 1 ms 3284 KB Output is correct
4 Correct 6 ms 16980 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 28 ms 77512 KB Output is correct
7 Correct 33 ms 77440 KB Output is correct
8 Correct 26 ms 77544 KB Output is correct
9 Correct 28 ms 77524 KB Output is correct
10 Correct 34 ms 77516 KB Output is correct
11 Correct 32 ms 77448 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4820 KB Output is correct
2 Correct 2 ms 6356 KB Output is correct
3 Correct 1 ms 3284 KB Output is correct
4 Correct 6 ms 16980 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 28 ms 77512 KB Output is correct
7 Correct 33 ms 77440 KB Output is correct
8 Correct 26 ms 77544 KB Output is correct
9 Correct 28 ms 77524 KB Output is correct
10 Correct 34 ms 77516 KB Output is correct
11 Correct 32 ms 77448 KB Output is correct
12 Correct 2 ms 4820 KB Output is correct
13 Correct 3 ms 6284 KB Output is correct
14 Correct 2 ms 3284 KB Output is correct
15 Correct 8 ms 16896 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 28 ms 77420 KB Output is correct
18 Correct 26 ms 77492 KB Output is correct
19 Correct 27 ms 77524 KB Output is correct
20 Correct 35 ms 77524 KB Output is correct
21 Correct 30 ms 77448 KB Output is correct
22 Correct 28 ms 77512 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 83 ms 153208 KB Output is correct
25 Correct 75 ms 153160 KB Output is correct
26 Correct 119 ms 153264 KB Output is correct
27 Correct 111 ms 153248 KB Output is correct
28 Correct 58 ms 153196 KB Output is correct
29 Correct 53 ms 153176 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 16980 KB Output is correct
2 Correct 15 ms 47168 KB Output is correct
3 Correct 21 ms 47228 KB Output is correct
4 Correct 15 ms 47192 KB Output is correct
5 Correct 17 ms 47232 KB Output is correct
6 Correct 20 ms 47216 KB Output is correct
7 Correct 14 ms 47200 KB Output is correct
8 Correct 16 ms 47180 KB Output is correct
9 Correct 15 ms 47188 KB Output is correct
10 Correct 20 ms 47204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 16980 KB Output is correct
2 Correct 15 ms 47168 KB Output is correct
3 Correct 21 ms 47228 KB Output is correct
4 Correct 15 ms 47192 KB Output is correct
5 Correct 17 ms 47232 KB Output is correct
6 Correct 20 ms 47216 KB Output is correct
7 Correct 14 ms 47200 KB Output is correct
8 Correct 16 ms 47180 KB Output is correct
9 Correct 15 ms 47188 KB Output is correct
10 Correct 20 ms 47204 KB Output is correct
11 Correct 2 ms 4820 KB Output is correct
12 Correct 2 ms 6356 KB Output is correct
13 Correct 2 ms 3284 KB Output is correct
14 Correct 7 ms 16980 KB Output is correct
15 Correct 18 ms 47228 KB Output is correct
16 Correct 19 ms 47188 KB Output is correct
17 Correct 18 ms 47136 KB Output is correct
18 Correct 17 ms 47192 KB Output is correct
19 Correct 16 ms 47188 KB Output is correct
20 Correct 15 ms 47188 KB Output is correct
21 Correct 15 ms 47240 KB Output is correct
22 Correct 16 ms 47220 KB Output is correct
23 Correct 24 ms 47140 KB Output is correct
24 Correct 18 ms 47176 KB Output is correct
25 Correct 15 ms 47248 KB Output is correct
26 Correct 15 ms 47216 KB Output is correct
27 Correct 15 ms 47248 KB Output is correct
28 Correct 16 ms 47188 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 16980 KB Output is correct
2 Correct 15 ms 47168 KB Output is correct
3 Correct 21 ms 47228 KB Output is correct
4 Correct 15 ms 47192 KB Output is correct
5 Correct 17 ms 47232 KB Output is correct
6 Correct 20 ms 47216 KB Output is correct
7 Correct 14 ms 47200 KB Output is correct
8 Correct 16 ms 47180 KB Output is correct
9 Correct 15 ms 47188 KB Output is correct
10 Correct 20 ms 47204 KB Output is correct
11 Correct 6 ms 16980 KB Output is correct
12 Correct 16 ms 47240 KB Output is correct
13 Correct 15 ms 47188 KB Output is correct
14 Correct 16 ms 47212 KB Output is correct
15 Correct 14 ms 47268 KB Output is correct
16 Correct 15 ms 47168 KB Output is correct
17 Correct 19 ms 47204 KB Output is correct
18 Correct 17 ms 47188 KB Output is correct
19 Correct 18 ms 47224 KB Output is correct
20 Correct 15 ms 47188 KB Output is correct
21 Correct 25 ms 77484 KB Output is correct
22 Correct 24 ms 77516 KB Output is correct
23 Correct 25 ms 77448 KB Output is correct
24 Correct 25 ms 77552 KB Output is correct
25 Correct 25 ms 77560 KB Output is correct
26 Correct 26 ms 77468 KB Output is correct
27 Correct 26 ms 77556 KB Output is correct
28 Correct 25 ms 77524 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4820 KB Output is correct
2 Correct 2 ms 6356 KB Output is correct
3 Correct 1 ms 3284 KB Output is correct
4 Correct 6 ms 16980 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 28 ms 77512 KB Output is correct
7 Correct 33 ms 77440 KB Output is correct
8 Correct 26 ms 77544 KB Output is correct
9 Correct 28 ms 77524 KB Output is correct
10 Correct 34 ms 77516 KB Output is correct
11 Correct 32 ms 77448 KB Output is correct
12 Correct 7 ms 16980 KB Output is correct
13 Correct 15 ms 47168 KB Output is correct
14 Correct 21 ms 47228 KB Output is correct
15 Correct 15 ms 47192 KB Output is correct
16 Correct 17 ms 47232 KB Output is correct
17 Correct 20 ms 47216 KB Output is correct
18 Correct 14 ms 47200 KB Output is correct
19 Correct 16 ms 47180 KB Output is correct
20 Correct 15 ms 47188 KB Output is correct
21 Correct 20 ms 47204 KB Output is correct
22 Correct 2 ms 4820 KB Output is correct
23 Correct 2 ms 6356 KB Output is correct
24 Correct 2 ms 3284 KB Output is correct
25 Correct 7 ms 16980 KB Output is correct
26 Correct 18 ms 47228 KB Output is correct
27 Correct 19 ms 47188 KB Output is correct
28 Correct 18 ms 47136 KB Output is correct
29 Correct 17 ms 47192 KB Output is correct
30 Correct 16 ms 47188 KB Output is correct
31 Correct 15 ms 47188 KB Output is correct
32 Correct 15 ms 47240 KB Output is correct
33 Correct 16 ms 47220 KB Output is correct
34 Correct 24 ms 47140 KB Output is correct
35 Correct 18 ms 47176 KB Output is correct
36 Correct 15 ms 47248 KB Output is correct
37 Correct 15 ms 47216 KB Output is correct
38 Correct 15 ms 47248 KB Output is correct
39 Correct 16 ms 47188 KB Output is correct
40 Correct 6 ms 16980 KB Output is correct
41 Correct 16 ms 47240 KB Output is correct
42 Correct 15 ms 47188 KB Output is correct
43 Correct 16 ms 47212 KB Output is correct
44 Correct 14 ms 47268 KB Output is correct
45 Correct 15 ms 47168 KB Output is correct
46 Correct 19 ms 47204 KB Output is correct
47 Correct 17 ms 47188 KB Output is correct
48 Correct 18 ms 47224 KB Output is correct
49 Correct 15 ms 47188 KB Output is correct
50 Correct 25 ms 77484 KB Output is correct
51 Correct 24 ms 77516 KB Output is correct
52 Correct 25 ms 77448 KB Output is correct
53 Correct 25 ms 77552 KB Output is correct
54 Correct 25 ms 77560 KB Output is correct
55 Correct 26 ms 77468 KB Output is correct
56 Correct 26 ms 77556 KB Output is correct
57 Correct 25 ms 77524 KB Output is correct
58 Correct 2 ms 4820 KB Output is correct
59 Correct 2 ms 6356 KB Output is correct
60 Correct 1 ms 3284 KB Output is correct
61 Correct 5 ms 16948 KB Output is correct
62 Correct 0 ms 212 KB Output is correct
63 Correct 30 ms 77440 KB Output is correct
64 Correct 26 ms 77596 KB Output is correct
65 Correct 27 ms 77484 KB Output is correct
66 Correct 28 ms 77540 KB Output is correct
67 Correct 26 ms 77468 KB Output is correct
68 Correct 26 ms 77468 KB Output is correct
69 Correct 16 ms 47240 KB Output is correct
70 Correct 15 ms 47176 KB Output is correct
71 Correct 17 ms 47256 KB Output is correct
72 Correct 16 ms 47184 KB Output is correct
73 Correct 15 ms 47192 KB Output is correct
74 Correct 15 ms 47188 KB Output is correct
75 Correct 16 ms 47260 KB Output is correct
76 Correct 16 ms 47212 KB Output is correct
77 Correct 15 ms 47240 KB Output is correct
78 Correct 16 ms 47188 KB Output is correct
79 Correct 15 ms 47164 KB Output is correct
80 Correct 16 ms 47188 KB Output is correct
81 Correct 15 ms 47256 KB Output is correct
82 Correct 15 ms 47152 KB Output is correct
83 Correct 26 ms 77460 KB Output is correct
84 Correct 25 ms 77480 KB Output is correct
85 Correct 26 ms 77524 KB Output is correct
86 Correct 28 ms 77516 KB Output is correct
87 Correct 25 ms 77524 KB Output is correct
88 Correct 26 ms 77464 KB Output is correct
89 Correct 27 ms 77556 KB Output is correct
90 Correct 27 ms 77440 KB Output is correct
91 Correct 26 ms 77536 KB Output is correct
92 Correct 28 ms 77452 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 16980 KB Output is correct
2 Correct 15 ms 47168 KB Output is correct
3 Correct 21 ms 47228 KB Output is correct
4 Correct 15 ms 47192 KB Output is correct
5 Correct 17 ms 47232 KB Output is correct
6 Correct 20 ms 47216 KB Output is correct
7 Correct 14 ms 47200 KB Output is correct
8 Correct 16 ms 47180 KB Output is correct
9 Correct 15 ms 47188 KB Output is correct
10 Correct 20 ms 47204 KB Output is correct
11 Correct 6 ms 16980 KB Output is correct
12 Correct 16 ms 47240 KB Output is correct
13 Correct 15 ms 47188 KB Output is correct
14 Correct 16 ms 47212 KB Output is correct
15 Correct 14 ms 47268 KB Output is correct
16 Correct 15 ms 47168 KB Output is correct
17 Correct 19 ms 47204 KB Output is correct
18 Correct 17 ms 47188 KB Output is correct
19 Correct 18 ms 47224 KB Output is correct
20 Correct 15 ms 47188 KB Output is correct
21 Correct 25 ms 77484 KB Output is correct
22 Correct 24 ms 77516 KB Output is correct
23 Correct 25 ms 77448 KB Output is correct
24 Correct 25 ms 77552 KB Output is correct
25 Correct 25 ms 77560 KB Output is correct
26 Correct 26 ms 77468 KB Output is correct
27 Correct 26 ms 77556 KB Output is correct
28 Correct 25 ms 77524 KB Output is correct
29 Correct 7 ms 16980 KB Output is correct
30 Correct 18 ms 47272 KB Output is correct
31 Correct 17 ms 47188 KB Output is correct
32 Correct 15 ms 47188 KB Output is correct
33 Correct 16 ms 47156 KB Output is correct
34 Correct 15 ms 47188 KB Output is correct
35 Correct 15 ms 47148 KB Output is correct
36 Correct 16 ms 47176 KB Output is correct
37 Correct 16 ms 47188 KB Output is correct
38 Correct 15 ms 47268 KB Output is correct
39 Correct 26 ms 77528 KB Output is correct
40 Correct 25 ms 77512 KB Output is correct
41 Correct 26 ms 77432 KB Output is correct
42 Correct 27 ms 77440 KB Output is correct
43 Correct 26 ms 77488 KB Output is correct
44 Correct 33 ms 77552 KB Output is correct
45 Correct 29 ms 77472 KB Output is correct
46 Correct 26 ms 77524 KB Output is correct
47 Correct 52 ms 153232 KB Output is correct
48 Correct 56 ms 153164 KB Output is correct
49 Correct 68 ms 153216 KB Output is correct
50 Correct 59 ms 153200 KB Output is correct
51 Correct 72 ms 153232 KB Output is correct
52 Correct 94 ms 153192 KB Output is correct
53 Correct 70 ms 153144 KB Output is correct
54 Correct 66 ms 153164 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4820 KB Output is correct
2 Correct 2 ms 6356 KB Output is correct
3 Correct 1 ms 3284 KB Output is correct
4 Correct 6 ms 16980 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 28 ms 77512 KB Output is correct
7 Correct 33 ms 77440 KB Output is correct
8 Correct 26 ms 77544 KB Output is correct
9 Correct 28 ms 77524 KB Output is correct
10 Correct 34 ms 77516 KB Output is correct
11 Correct 32 ms 77448 KB Output is correct
12 Correct 2 ms 4820 KB Output is correct
13 Correct 3 ms 6284 KB Output is correct
14 Correct 2 ms 3284 KB Output is correct
15 Correct 8 ms 16896 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 28 ms 77420 KB Output is correct
18 Correct 26 ms 77492 KB Output is correct
19 Correct 27 ms 77524 KB Output is correct
20 Correct 35 ms 77524 KB Output is correct
21 Correct 30 ms 77448 KB Output is correct
22 Correct 28 ms 77512 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 83 ms 153208 KB Output is correct
25 Correct 75 ms 153160 KB Output is correct
26 Correct 119 ms 153264 KB Output is correct
27 Correct 111 ms 153248 KB Output is correct
28 Correct 58 ms 153196 KB Output is correct
29 Correct 53 ms 153176 KB Output is correct
30 Correct 7 ms 16980 KB Output is correct
31 Correct 15 ms 47168 KB Output is correct
32 Correct 21 ms 47228 KB Output is correct
33 Correct 15 ms 47192 KB Output is correct
34 Correct 17 ms 47232 KB Output is correct
35 Correct 20 ms 47216 KB Output is correct
36 Correct 14 ms 47200 KB Output is correct
37 Correct 16 ms 47180 KB Output is correct
38 Correct 15 ms 47188 KB Output is correct
39 Correct 20 ms 47204 KB Output is correct
40 Correct 2 ms 4820 KB Output is correct
41 Correct 2 ms 6356 KB Output is correct
42 Correct 2 ms 3284 KB Output is correct
43 Correct 7 ms 16980 KB Output is correct
44 Correct 18 ms 47228 KB Output is correct
45 Correct 19 ms 47188 KB Output is correct
46 Correct 18 ms 47136 KB Output is correct
47 Correct 17 ms 47192 KB Output is correct
48 Correct 16 ms 47188 KB Output is correct
49 Correct 15 ms 47188 KB Output is correct
50 Correct 15 ms 47240 KB Output is correct
51 Correct 16 ms 47220 KB Output is correct
52 Correct 24 ms 47140 KB Output is correct
53 Correct 18 ms 47176 KB Output is correct
54 Correct 15 ms 47248 KB Output is correct
55 Correct 15 ms 47216 KB Output is correct
56 Correct 15 ms 47248 KB Output is correct
57 Correct 16 ms 47188 KB Output is correct
58 Correct 6 ms 16980 KB Output is correct
59 Correct 16 ms 47240 KB Output is correct
60 Correct 15 ms 47188 KB Output is correct
61 Correct 16 ms 47212 KB Output is correct
62 Correct 14 ms 47268 KB Output is correct
63 Correct 15 ms 47168 KB Output is correct
64 Correct 19 ms 47204 KB Output is correct
65 Correct 17 ms 47188 KB Output is correct
66 Correct 18 ms 47224 KB Output is correct
67 Correct 15 ms 47188 KB Output is correct
68 Correct 25 ms 77484 KB Output is correct
69 Correct 24 ms 77516 KB Output is correct
70 Correct 25 ms 77448 KB Output is correct
71 Correct 25 ms 77552 KB Output is correct
72 Correct 25 ms 77560 KB Output is correct
73 Correct 26 ms 77468 KB Output is correct
74 Correct 26 ms 77556 KB Output is correct
75 Correct 25 ms 77524 KB Output is correct
76 Correct 2 ms 4820 KB Output is correct
77 Correct 2 ms 6356 KB Output is correct
78 Correct 1 ms 3284 KB Output is correct
79 Correct 5 ms 16948 KB Output is correct
80 Correct 0 ms 212 KB Output is correct
81 Correct 30 ms 77440 KB Output is correct
82 Correct 26 ms 77596 KB Output is correct
83 Correct 27 ms 77484 KB Output is correct
84 Correct 28 ms 77540 KB Output is correct
85 Correct 26 ms 77468 KB Output is correct
86 Correct 26 ms 77468 KB Output is correct
87 Correct 16 ms 47240 KB Output is correct
88 Correct 15 ms 47176 KB Output is correct
89 Correct 17 ms 47256 KB Output is correct
90 Correct 16 ms 47184 KB Output is correct
91 Correct 15 ms 47192 KB Output is correct
92 Correct 15 ms 47188 KB Output is correct
93 Correct 16 ms 47260 KB Output is correct
94 Correct 16 ms 47212 KB Output is correct
95 Correct 15 ms 47240 KB Output is correct
96 Correct 16 ms 47188 KB Output is correct
97 Correct 15 ms 47164 KB Output is correct
98 Correct 16 ms 47188 KB Output is correct
99 Correct 15 ms 47256 KB Output is correct
100 Correct 15 ms 47152 KB Output is correct
101 Correct 26 ms 77460 KB Output is correct
102 Correct 25 ms 77480 KB Output is correct
103 Correct 26 ms 77524 KB Output is correct
104 Correct 28 ms 77516 KB Output is correct
105 Correct 25 ms 77524 KB Output is correct
106 Correct 26 ms 77464 KB Output is correct
107 Correct 27 ms 77556 KB Output is correct
108 Correct 27 ms 77440 KB Output is correct
109 Correct 26 ms 77536 KB Output is correct
110 Correct 28 ms 77452 KB Output is correct
111 Correct 7 ms 16980 KB Output is correct
112 Correct 18 ms 47272 KB Output is correct
113 Correct 17 ms 47188 KB Output is correct
114 Correct 15 ms 47188 KB Output is correct
115 Correct 16 ms 47156 KB Output is correct
116 Correct 15 ms 47188 KB Output is correct
117 Correct 15 ms 47148 KB Output is correct
118 Correct 16 ms 47176 KB Output is correct
119 Correct 16 ms 47188 KB Output is correct
120 Correct 15 ms 47268 KB Output is correct
121 Correct 26 ms 77528 KB Output is correct
122 Correct 25 ms 77512 KB Output is correct
123 Correct 26 ms 77432 KB Output is correct
124 Correct 27 ms 77440 KB Output is correct
125 Correct 26 ms 77488 KB Output is correct
126 Correct 33 ms 77552 KB Output is correct
127 Correct 29 ms 77472 KB Output is correct
128 Correct 26 ms 77524 KB Output is correct
129 Correct 52 ms 153232 KB Output is correct
130 Correct 56 ms 153164 KB Output is correct
131 Correct 68 ms 153216 KB Output is correct
132 Correct 59 ms 153200 KB Output is correct
133 Correct 72 ms 153232 KB Output is correct
134 Correct 94 ms 153192 KB Output is correct
135 Correct 70 ms 153144 KB Output is correct
136 Correct 66 ms 153164 KB Output is correct
137 Correct 2 ms 4820 KB Output is correct
138 Correct 2 ms 6356 KB Output is correct
139 Correct 1 ms 3284 KB Output is correct
140 Correct 6 ms 16980 KB Output is correct
141 Correct 0 ms 212 KB Output is correct
142 Correct 27 ms 77508 KB Output is correct
143 Correct 27 ms 77488 KB Output is correct
144 Correct 29 ms 77440 KB Output is correct
145 Correct 28 ms 77540 KB Output is correct
146 Correct 29 ms 77484 KB Output is correct
147 Correct 28 ms 77468 KB Output is correct
148 Correct 0 ms 212 KB Output is correct
149 Correct 82 ms 153188 KB Output is correct
150 Correct 74 ms 153256 KB Output is correct
151 Correct 115 ms 153244 KB Output is correct
152 Correct 101 ms 153136 KB Output is correct
153 Correct 54 ms 153164 KB Output is correct
154 Correct 54 ms 153168 KB Output is correct
155 Correct 17 ms 47236 KB Output is correct
156 Correct 19 ms 47216 KB Output is correct
157 Correct 18 ms 47188 KB Output is correct
158 Correct 18 ms 47244 KB Output is correct
159 Correct 17 ms 47176 KB Output is correct
160 Correct 19 ms 47188 KB Output is correct
161 Correct 17 ms 47248 KB Output is correct
162 Correct 16 ms 47176 KB Output is correct
163 Correct 17 ms 47180 KB Output is correct
164 Correct 28 ms 77520 KB Output is correct
165 Correct 29 ms 77536 KB Output is correct
166 Correct 29 ms 77436 KB Output is correct
167 Correct 28 ms 77532 KB Output is correct
168 Correct 28 ms 77460 KB Output is correct
169 Correct 27 ms 77516 KB Output is correct
170 Correct 17 ms 47228 KB Output is correct
171 Correct 17 ms 47160 KB Output is correct
172 Correct 18 ms 47160 KB Output is correct
173 Correct 17 ms 47208 KB Output is correct
174 Correct 17 ms 47272 KB Output is correct
175 Correct 29 ms 77468 KB Output is correct
176 Correct 29 ms 77524 KB Output is correct
177 Correct 29 ms 77520 KB Output is correct
178 Correct 29 ms 77436 KB Output is correct
179 Correct 73 ms 153268 KB Output is correct
180 Correct 61 ms 153164 KB Output is correct
181 Correct 74 ms 153180 KB Output is correct
182 Correct 80 ms 153164 KB Output is correct
183 Correct 73 ms 153244 KB Output is correct
184 Correct 66 ms 153188 KB Output is correct
185 Correct 91 ms 153204 KB Output is correct
186 Correct 110 ms 153240 KB Output is correct
187 Correct 89 ms 153212 KB Output is correct
188 Correct 89 ms 153176 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 16980 KB Output is correct
2 Correct 15 ms 47168 KB Output is correct
3 Correct 21 ms 47228 KB Output is correct
4 Correct 15 ms 47192 KB Output is correct
5 Correct 17 ms 47232 KB Output is correct
6 Correct 20 ms 47216 KB Output is correct
7 Correct 14 ms 47200 KB Output is correct
8 Correct 16 ms 47180 KB Output is correct
9 Correct 15 ms 47188 KB Output is correct
10 Correct 20 ms 47204 KB Output is correct
11 Correct 6 ms 16980 KB Output is correct
12 Correct 16 ms 47240 KB Output is correct
13 Correct 15 ms 47188 KB Output is correct
14 Correct 16 ms 47212 KB Output is correct
15 Correct 14 ms 47268 KB Output is correct
16 Correct 15 ms 47168 KB Output is correct
17 Correct 19 ms 47204 KB Output is correct
18 Correct 17 ms 47188 KB Output is correct
19 Correct 18 ms 47224 KB Output is correct
20 Correct 15 ms 47188 KB Output is correct
21 Correct 25 ms 77484 KB Output is correct
22 Correct 24 ms 77516 KB Output is correct
23 Correct 25 ms 77448 KB Output is correct
24 Correct 25 ms 77552 KB Output is correct
25 Correct 25 ms 77560 KB Output is correct
26 Correct 26 ms 77468 KB Output is correct
27 Correct 26 ms 77556 KB Output is correct
28 Correct 25 ms 77524 KB Output is correct
29 Correct 7 ms 16980 KB Output is correct
30 Correct 18 ms 47272 KB Output is correct
31 Correct 17 ms 47188 KB Output is correct
32 Correct 15 ms 47188 KB Output is correct
33 Correct 16 ms 47156 KB Output is correct
34 Correct 15 ms 47188 KB Output is correct
35 Correct 15 ms 47148 KB Output is correct
36 Correct 16 ms 47176 KB Output is correct
37 Correct 16 ms 47188 KB Output is correct
38 Correct 15 ms 47268 KB Output is correct
39 Correct 26 ms 77528 KB Output is correct
40 Correct 25 ms 77512 KB Output is correct
41 Correct 26 ms 77432 KB Output is correct
42 Correct 27 ms 77440 KB Output is correct
43 Correct 26 ms 77488 KB Output is correct
44 Correct 33 ms 77552 KB Output is correct
45 Correct 29 ms 77472 KB Output is correct
46 Correct 26 ms 77524 KB Output is correct
47 Correct 52 ms 153232 KB Output is correct
48 Correct 56 ms 153164 KB Output is correct
49 Correct 68 ms 153216 KB Output is correct
50 Correct 59 ms 153200 KB Output is correct
51 Correct 72 ms 153232 KB Output is correct
52 Correct 94 ms 153192 KB Output is correct
53 Correct 70 ms 153144 KB Output is correct
54 Correct 66 ms 153164 KB Output is correct
55 Correct 6 ms 16852 KB Output is correct
56 Correct 20 ms 47188 KB Output is correct
57 Correct 17 ms 47204 KB Output is correct
58 Correct 17 ms 47188 KB Output is correct
59 Correct 17 ms 47188 KB Output is correct
60 Correct 21 ms 47164 KB Output is correct
61 Correct 17 ms 47160 KB Output is correct
62 Correct 17 ms 47156 KB Output is correct
63 Correct 17 ms 47220 KB Output is correct
64 Correct 17 ms 47188 KB Output is correct
65 Correct 26 ms 77420 KB Output is correct
66 Correct 26 ms 77516 KB Output is correct
67 Correct 28 ms 77488 KB Output is correct
68 Correct 28 ms 77496 KB Output is correct
69 Correct 28 ms 77472 KB Output is correct
70 Correct 32 ms 77428 KB Output is correct
71 Correct 28 ms 77552 KB Output is correct
72 Correct 27 ms 77524 KB Output is correct
73 Correct 53 ms 153140 KB Output is correct
74 Correct 53 ms 153180 KB Output is correct
75 Correct 69 ms 153220 KB Output is correct
76 Correct 61 ms 153128 KB Output is correct
77 Correct 75 ms 153172 KB Output is correct
78 Correct 79 ms 153244 KB Output is correct
79 Correct 72 ms 153188 KB Output is correct
80 Correct 64 ms 153188 KB Output is correct
81 Correct 1725 ms 456052 KB Output is correct
82 Correct 902 ms 456048 KB Output is correct
83 Correct 1683 ms 456052 KB Output is correct
84 Correct 2191 ms 455980 KB Output is correct
85 Correct 308 ms 456232 KB Output is correct
86 Correct 282 ms 456032 KB Output is correct
87 Correct 1355 ms 456136 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4820 KB Output is correct
2 Correct 2 ms 6356 KB Output is correct
3 Correct 1 ms 3284 KB Output is correct
4 Correct 6 ms 16980 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 28 ms 77512 KB Output is correct
7 Correct 33 ms 77440 KB Output is correct
8 Correct 26 ms 77544 KB Output is correct
9 Correct 28 ms 77524 KB Output is correct
10 Correct 34 ms 77516 KB Output is correct
11 Correct 32 ms 77448 KB Output is correct
12 Correct 2 ms 4820 KB Output is correct
13 Correct 3 ms 6284 KB Output is correct
14 Correct 2 ms 3284 KB Output is correct
15 Correct 8 ms 16896 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 28 ms 77420 KB Output is correct
18 Correct 26 ms 77492 KB Output is correct
19 Correct 27 ms 77524 KB Output is correct
20 Correct 35 ms 77524 KB Output is correct
21 Correct 30 ms 77448 KB Output is correct
22 Correct 28 ms 77512 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 83 ms 153208 KB Output is correct
25 Correct 75 ms 153160 KB Output is correct
26 Correct 119 ms 153264 KB Output is correct
27 Correct 111 ms 153248 KB Output is correct
28 Correct 58 ms 153196 KB Output is correct
29 Correct 53 ms 153176 KB Output is correct
30 Correct 7 ms 16980 KB Output is correct
31 Correct 15 ms 47168 KB Output is correct
32 Correct 21 ms 47228 KB Output is correct
33 Correct 15 ms 47192 KB Output is correct
34 Correct 17 ms 47232 KB Output is correct
35 Correct 20 ms 47216 KB Output is correct
36 Correct 14 ms 47200 KB Output is correct
37 Correct 16 ms 47180 KB Output is correct
38 Correct 15 ms 47188 KB Output is correct
39 Correct 20 ms 47204 KB Output is correct
40 Correct 2 ms 4820 KB Output is correct
41 Correct 2 ms 6356 KB Output is correct
42 Correct 2 ms 3284 KB Output is correct
43 Correct 7 ms 16980 KB Output is correct
44 Correct 18 ms 47228 KB Output is correct
45 Correct 19 ms 47188 KB Output is correct
46 Correct 18 ms 47136 KB Output is correct
47 Correct 17 ms 47192 KB Output is correct
48 Correct 16 ms 47188 KB Output is correct
49 Correct 15 ms 47188 KB Output is correct
50 Correct 15 ms 47240 KB Output is correct
51 Correct 16 ms 47220 KB Output is correct
52 Correct 24 ms 47140 KB Output is correct
53 Correct 18 ms 47176 KB Output is correct
54 Correct 15 ms 47248 KB Output is correct
55 Correct 15 ms 47216 KB Output is correct
56 Correct 15 ms 47248 KB Output is correct
57 Correct 16 ms 47188 KB Output is correct
58 Correct 6 ms 16980 KB Output is correct
59 Correct 16 ms 47240 KB Output is correct
60 Correct 15 ms 47188 KB Output is correct
61 Correct 16 ms 47212 KB Output is correct
62 Correct 14 ms 47268 KB Output is correct
63 Correct 15 ms 47168 KB Output is correct
64 Correct 19 ms 47204 KB Output is correct
65 Correct 17 ms 47188 KB Output is correct
66 Correct 18 ms 47224 KB Output is correct
67 Correct 15 ms 47188 KB Output is correct
68 Correct 25 ms 77484 KB Output is correct
69 Correct 24 ms 77516 KB Output is correct
70 Correct 25 ms 77448 KB Output is correct
71 Correct 25 ms 77552 KB Output is correct
72 Correct 25 ms 77560 KB Output is correct
73 Correct 26 ms 77468 KB Output is correct
74 Correct 26 ms 77556 KB Output is correct
75 Correct 25 ms 77524 KB Output is correct
76 Correct 2 ms 4820 KB Output is correct
77 Correct 2 ms 6356 KB Output is correct
78 Correct 1 ms 3284 KB Output is correct
79 Correct 5 ms 16948 KB Output is correct
80 Correct 0 ms 212 KB Output is correct
81 Correct 30 ms 77440 KB Output is correct
82 Correct 26 ms 77596 KB Output is correct
83 Correct 27 ms 77484 KB Output is correct
84 Correct 28 ms 77540 KB Output is correct
85 Correct 26 ms 77468 KB Output is correct
86 Correct 26 ms 77468 KB Output is correct
87 Correct 16 ms 47240 KB Output is correct
88 Correct 15 ms 47176 KB Output is correct
89 Correct 17 ms 47256 KB Output is correct
90 Correct 16 ms 47184 KB Output is correct
91 Correct 15 ms 47192 KB Output is correct
92 Correct 15 ms 47188 KB Output is correct
93 Correct 16 ms 47260 KB Output is correct
94 Correct 16 ms 47212 KB Output is correct
95 Correct 15 ms 47240 KB Output is correct
96 Correct 16 ms 47188 KB Output is correct
97 Correct 15 ms 47164 KB Output is correct
98 Correct 16 ms 47188 KB Output is correct
99 Correct 15 ms 47256 KB Output is correct
100 Correct 15 ms 47152 KB Output is correct
101 Correct 26 ms 77460 KB Output is correct
102 Correct 25 ms 77480 KB Output is correct
103 Correct 26 ms 77524 KB Output is correct
104 Correct 28 ms 77516 KB Output is correct
105 Correct 25 ms 77524 KB Output is correct
106 Correct 26 ms 77464 KB Output is correct
107 Correct 27 ms 77556 KB Output is correct
108 Correct 27 ms 77440 KB Output is correct
109 Correct 26 ms 77536 KB Output is correct
110 Correct 28 ms 77452 KB Output is correct
111 Correct 7 ms 16980 KB Output is correct
112 Correct 18 ms 47272 KB Output is correct
113 Correct 17 ms 47188 KB Output is correct
114 Correct 15 ms 47188 KB Output is correct
115 Correct 16 ms 47156 KB Output is correct
116 Correct 15 ms 47188 KB Output is correct
117 Correct 15 ms 47148 KB Output is correct
118 Correct 16 ms 47176 KB Output is correct
119 Correct 16 ms 47188 KB Output is correct
120 Correct 15 ms 47268 KB Output is correct
121 Correct 26 ms 77528 KB Output is correct
122 Correct 25 ms 77512 KB Output is correct
123 Correct 26 ms 77432 KB Output is correct
124 Correct 27 ms 77440 KB Output is correct
125 Correct 26 ms 77488 KB Output is correct
126 Correct 33 ms 77552 KB Output is correct
127 Correct 29 ms 77472 KB Output is correct
128 Correct 26 ms 77524 KB Output is correct
129 Correct 52 ms 153232 KB Output is correct
130 Correct 56 ms 153164 KB Output is correct
131 Correct 68 ms 153216 KB Output is correct
132 Correct 59 ms 153200 KB Output is correct
133 Correct 72 ms 153232 KB Output is correct
134 Correct 94 ms 153192 KB Output is correct
135 Correct 70 ms 153144 KB Output is correct
136 Correct 66 ms 153164 KB Output is correct
137 Correct 2 ms 4820 KB Output is correct
138 Correct 2 ms 6356 KB Output is correct
139 Correct 1 ms 3284 KB Output is correct
140 Correct 6 ms 16980 KB Output is correct
141 Correct 0 ms 212 KB Output is correct
142 Correct 27 ms 77508 KB Output is correct
143 Correct 27 ms 77488 KB Output is correct
144 Correct 29 ms 77440 KB Output is correct
145 Correct 28 ms 77540 KB Output is correct
146 Correct 29 ms 77484 KB Output is correct
147 Correct 28 ms 77468 KB Output is correct
148 Correct 0 ms 212 KB Output is correct
149 Correct 82 ms 153188 KB Output is correct
150 Correct 74 ms 153256 KB Output is correct
151 Correct 115 ms 153244 KB Output is correct
152 Correct 101 ms 153136 KB Output is correct
153 Correct 54 ms 153164 KB Output is correct
154 Correct 54 ms 153168 KB Output is correct
155 Correct 17 ms 47236 KB Output is correct
156 Correct 19 ms 47216 KB Output is correct
157 Correct 18 ms 47188 KB Output is correct
158 Correct 18 ms 47244 KB Output is correct
159 Correct 17 ms 47176 KB Output is correct
160 Correct 19 ms 47188 KB Output is correct
161 Correct 17 ms 47248 KB Output is correct
162 Correct 16 ms 47176 KB Output is correct
163 Correct 17 ms 47180 KB Output is correct
164 Correct 28 ms 77520 KB Output is correct
165 Correct 29 ms 77536 KB Output is correct
166 Correct 29 ms 77436 KB Output is correct
167 Correct 28 ms 77532 KB Output is correct
168 Correct 28 ms 77460 KB Output is correct
169 Correct 27 ms 77516 KB Output is correct
170 Correct 17 ms 47228 KB Output is correct
171 Correct 17 ms 47160 KB Output is correct
172 Correct 18 ms 47160 KB Output is correct
173 Correct 17 ms 47208 KB Output is correct
174 Correct 17 ms 47272 KB Output is correct
175 Correct 29 ms 77468 KB Output is correct
176 Correct 29 ms 77524 KB Output is correct
177 Correct 29 ms 77520 KB Output is correct
178 Correct 29 ms 77436 KB Output is correct
179 Correct 73 ms 153268 KB Output is correct
180 Correct 61 ms 153164 KB Output is correct
181 Correct 74 ms 153180 KB Output is correct
182 Correct 80 ms 153164 KB Output is correct
183 Correct 73 ms 153244 KB Output is correct
184 Correct 66 ms 153188 KB Output is correct
185 Correct 91 ms 153204 KB Output is correct
186 Correct 110 ms 153240 KB Output is correct
187 Correct 89 ms 153212 KB Output is correct
188 Correct 89 ms 153176 KB Output is correct
189 Correct 6 ms 16852 KB Output is correct
190 Correct 20 ms 47188 KB Output is correct
191 Correct 17 ms 47204 KB Output is correct
192 Correct 17 ms 47188 KB Output is correct
193 Correct 17 ms 47188 KB Output is correct
194 Correct 21 ms 47164 KB Output is correct
195 Correct 17 ms 47160 KB Output is correct
196 Correct 17 ms 47156 KB Output is correct
197 Correct 17 ms 47220 KB Output is correct
198 Correct 17 ms 47188 KB Output is correct
199 Correct 26 ms 77420 KB Output is correct
200 Correct 26 ms 77516 KB Output is correct
201 Correct 28 ms 77488 KB Output is correct
202 Correct 28 ms 77496 KB Output is correct
203 Correct 28 ms 77472 KB Output is correct
204 Correct 32 ms 77428 KB Output is correct
205 Correct 28 ms 77552 KB Output is correct
206 Correct 27 ms 77524 KB Output is correct
207 Correct 53 ms 153140 KB Output is correct
208 Correct 53 ms 153180 KB Output is correct
209 Correct 69 ms 153220 KB Output is correct
210 Correct 61 ms 153128 KB Output is correct
211 Correct 75 ms 153172 KB Output is correct
212 Correct 79 ms 153244 KB Output is correct
213 Correct 72 ms 153188 KB Output is correct
214 Correct 64 ms 153188 KB Output is correct
215 Correct 1725 ms 456052 KB Output is correct
216 Correct 902 ms 456048 KB Output is correct
217 Correct 1683 ms 456052 KB Output is correct
218 Correct 2191 ms 455980 KB Output is correct
219 Correct 308 ms 456232 KB Output is correct
220 Correct 282 ms 456032 KB Output is correct
221 Correct 1355 ms 456136 KB Output is correct
222 Correct 7 ms 16980 KB Output is correct
223 Correct 17 ms 47188 KB Output is correct
224 Correct 19 ms 47184 KB Output is correct
225 Correct 19 ms 47224 KB Output is correct
226 Correct 17 ms 47160 KB Output is correct
227 Correct 20 ms 47160 KB Output is correct
228 Correct 18 ms 47188 KB Output is correct
229 Correct 17 ms 47172 KB Output is correct
230 Correct 17 ms 47188 KB Output is correct
231 Correct 19 ms 47160 KB Output is correct
232 Correct 31 ms 77464 KB Output is correct
233 Correct 29 ms 77484 KB Output is correct
234 Correct 31 ms 77456 KB Output is correct
235 Correct 30 ms 77448 KB Output is correct
236 Correct 30 ms 77524 KB Output is correct
237 Correct 31 ms 77524 KB Output is correct
238 Correct 31 ms 77488 KB Output is correct
239 Correct 33 ms 77460 KB Output is correct
240 Correct 57 ms 153252 KB Output is correct
241 Correct 58 ms 153216 KB Output is correct
242 Correct 74 ms 153148 KB Output is correct
243 Correct 68 ms 153308 KB Output is correct
244 Correct 78 ms 153184 KB Output is correct
245 Correct 83 ms 153164 KB Output is correct
246 Correct 75 ms 153196 KB Output is correct
247 Correct 69 ms 153212 KB Output is correct
248 Correct 2 ms 4820 KB Output is correct
249 Correct 3 ms 6356 KB Output is correct
250 Correct 1 ms 3284 KB Output is correct
251 Correct 0 ms 312 KB Output is correct
252 Correct 34 ms 77580 KB Output is correct
253 Correct 30 ms 77516 KB Output is correct
254 Correct 32 ms 77500 KB Output is correct
255 Correct 31 ms 77544 KB Output is correct
256 Correct 0 ms 212 KB Output is correct
257 Correct 86 ms 153180 KB Output is correct
258 Correct 69 ms 153252 KB Output is correct
259 Correct 103 ms 153196 KB Output is correct
260 Correct 106 ms 153304 KB Output is correct
261 Correct 18 ms 47188 KB Output is correct
262 Correct 18 ms 47196 KB Output is correct
263 Correct 18 ms 47252 KB Output is correct
264 Correct 18 ms 47200 KB Output is correct
265 Correct 19 ms 47188 KB Output is correct
266 Correct 30 ms 77524 KB Output is correct
267 Correct 31 ms 77524 KB Output is correct
268 Correct 32 ms 77436 KB Output is correct
269 Correct 31 ms 77516 KB Output is correct
270 Correct 90 ms 153132 KB Output is correct
271 Correct 103 ms 153208 KB Output is correct
272 Correct 90 ms 153196 KB Output is correct
273 Correct 104 ms 153200 KB Output is correct
274 Correct 1714 ms 456044 KB Output is correct
275 Correct 920 ms 456104 KB Output is correct
276 Correct 1664 ms 456104 KB Output is correct
277 Correct 2237 ms 456060 KB Output is correct
278 Correct 304 ms 456180 KB Output is correct
279 Correct 287 ms 456032 KB Output is correct
280 Correct 1311 ms 456032 KB Output is correct
281 Correct 3156 ms 456032 KB Output is correct
282 Correct 4097 ms 456108 KB Output is correct
283 Correct 3173 ms 456060 KB Output is correct