# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
577811 | 2022-06-15T09:28:48 Z | kingfran1907 | Uplifting Excursion (BOI22_vault) | C++14 | 5000 ms | 427340 KB |
#include <bits/stdc++.h> #define X first #define Y second using namespace std; typedef long long llint; const int maxn = 301; const int buf = maxn * maxn; const int inf = 0x3f3f3f3f; int n; llint l; int niz[2 * maxn]; int dp[2 * maxn][2 * maxn * maxn]; int f(int x, int val) { if (x == n + 1) { if (val == l) return 0; else return -inf; } int &ret = dp[x + maxn][val + buf]; if (ret != -1) return ret; ret = -inf; for (int i = 0; i <= niz[x + n]; i++) { ret = max(ret, i + f(x + 1, val + i * x)); } return ret; } int main() { scanf("%d%lld\n", &n, &l); for (int i = 0; i < n + n + 1; i++) scanf("%d", niz+i); memset(dp, -1, sizeof dp); int out = f(-n, 0); if (out < 0) printf("impossible\n"); else printf("%d\n", out); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 165 ms | 427224 KB | Output is correct |
2 | Correct | 186 ms | 427104 KB | Output is correct |
3 | Correct | 153 ms | 427120 KB | Output is correct |
4 | Correct | 170 ms | 427124 KB | Output is correct |
5 | Correct | 687 ms | 427224 KB | Output is correct |
6 | Correct | 677 ms | 427340 KB | Output is correct |
7 | Correct | 256 ms | 427212 KB | Output is correct |
8 | Correct | 582 ms | 427220 KB | Output is correct |
9 | Correct | 1653 ms | 427228 KB | Output is correct |
10 | Correct | 154 ms | 427192 KB | Output is correct |
11 | Correct | 188 ms | 427124 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 165 ms | 427224 KB | Output is correct |
2 | Correct | 186 ms | 427104 KB | Output is correct |
3 | Correct | 153 ms | 427120 KB | Output is correct |
4 | Correct | 170 ms | 427124 KB | Output is correct |
5 | Correct | 687 ms | 427224 KB | Output is correct |
6 | Correct | 677 ms | 427340 KB | Output is correct |
7 | Correct | 256 ms | 427212 KB | Output is correct |
8 | Correct | 582 ms | 427220 KB | Output is correct |
9 | Correct | 1653 ms | 427228 KB | Output is correct |
10 | Correct | 154 ms | 427192 KB | Output is correct |
11 | Correct | 188 ms | 427124 KB | Output is correct |
12 | Correct | 152 ms | 427340 KB | Output is correct |
13 | Correct | 161 ms | 427180 KB | Output is correct |
14 | Correct | 157 ms | 427140 KB | Output is correct |
15 | Correct | 154 ms | 427108 KB | Output is correct |
16 | Correct | 634 ms | 427236 KB | Output is correct |
17 | Correct | 636 ms | 427232 KB | Output is correct |
18 | Correct | 248 ms | 427220 KB | Output is correct |
19 | Correct | 625 ms | 427288 KB | Output is correct |
20 | Correct | 1620 ms | 427240 KB | Output is correct |
21 | Correct | 170 ms | 427208 KB | Output is correct |
22 | Correct | 155 ms | 427156 KB | Output is correct |
23 | Execution timed out | 5089 ms | 427212 KB | Time limit exceeded |
24 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 162 ms | 427204 KB | Output is correct |
2 | Incorrect | 154 ms | 427216 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 162 ms | 427204 KB | Output is correct |
2 | Incorrect | 154 ms | 427216 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 162 ms | 427204 KB | Output is correct |
2 | Incorrect | 154 ms | 427216 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 165 ms | 427224 KB | Output is correct |
2 | Correct | 186 ms | 427104 KB | Output is correct |
3 | Correct | 153 ms | 427120 KB | Output is correct |
4 | Correct | 170 ms | 427124 KB | Output is correct |
5 | Correct | 687 ms | 427224 KB | Output is correct |
6 | Correct | 677 ms | 427340 KB | Output is correct |
7 | Correct | 256 ms | 427212 KB | Output is correct |
8 | Correct | 582 ms | 427220 KB | Output is correct |
9 | Correct | 1653 ms | 427228 KB | Output is correct |
10 | Correct | 154 ms | 427192 KB | Output is correct |
11 | Correct | 188 ms | 427124 KB | Output is correct |
12 | Correct | 162 ms | 427204 KB | Output is correct |
13 | Incorrect | 154 ms | 427216 KB | Output isn't correct |
14 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 162 ms | 427204 KB | Output is correct |
2 | Incorrect | 154 ms | 427216 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 165 ms | 427224 KB | Output is correct |
2 | Correct | 186 ms | 427104 KB | Output is correct |
3 | Correct | 153 ms | 427120 KB | Output is correct |
4 | Correct | 170 ms | 427124 KB | Output is correct |
5 | Correct | 687 ms | 427224 KB | Output is correct |
6 | Correct | 677 ms | 427340 KB | Output is correct |
7 | Correct | 256 ms | 427212 KB | Output is correct |
8 | Correct | 582 ms | 427220 KB | Output is correct |
9 | Correct | 1653 ms | 427228 KB | Output is correct |
10 | Correct | 154 ms | 427192 KB | Output is correct |
11 | Correct | 188 ms | 427124 KB | Output is correct |
12 | Correct | 152 ms | 427340 KB | Output is correct |
13 | Correct | 161 ms | 427180 KB | Output is correct |
14 | Correct | 157 ms | 427140 KB | Output is correct |
15 | Correct | 154 ms | 427108 KB | Output is correct |
16 | Correct | 634 ms | 427236 KB | Output is correct |
17 | Correct | 636 ms | 427232 KB | Output is correct |
18 | Correct | 248 ms | 427220 KB | Output is correct |
19 | Correct | 625 ms | 427288 KB | Output is correct |
20 | Correct | 1620 ms | 427240 KB | Output is correct |
21 | Correct | 170 ms | 427208 KB | Output is correct |
22 | Correct | 155 ms | 427156 KB | Output is correct |
23 | Execution timed out | 5089 ms | 427212 KB | Time limit exceeded |
24 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 162 ms | 427204 KB | Output is correct |
2 | Incorrect | 154 ms | 427216 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 165 ms | 427224 KB | Output is correct |
2 | Correct | 186 ms | 427104 KB | Output is correct |
3 | Correct | 153 ms | 427120 KB | Output is correct |
4 | Correct | 170 ms | 427124 KB | Output is correct |
5 | Correct | 687 ms | 427224 KB | Output is correct |
6 | Correct | 677 ms | 427340 KB | Output is correct |
7 | Correct | 256 ms | 427212 KB | Output is correct |
8 | Correct | 582 ms | 427220 KB | Output is correct |
9 | Correct | 1653 ms | 427228 KB | Output is correct |
10 | Correct | 154 ms | 427192 KB | Output is correct |
11 | Correct | 188 ms | 427124 KB | Output is correct |
12 | Correct | 152 ms | 427340 KB | Output is correct |
13 | Correct | 161 ms | 427180 KB | Output is correct |
14 | Correct | 157 ms | 427140 KB | Output is correct |
15 | Correct | 154 ms | 427108 KB | Output is correct |
16 | Correct | 634 ms | 427236 KB | Output is correct |
17 | Correct | 636 ms | 427232 KB | Output is correct |
18 | Correct | 248 ms | 427220 KB | Output is correct |
19 | Correct | 625 ms | 427288 KB | Output is correct |
20 | Correct | 1620 ms | 427240 KB | Output is correct |
21 | Correct | 170 ms | 427208 KB | Output is correct |
22 | Correct | 155 ms | 427156 KB | Output is correct |
23 | Execution timed out | 5089 ms | 427212 KB | Time limit exceeded |
24 | Halted | 0 ms | 0 KB | - |