# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
577818 | 2022-06-15T09:34:04 Z | kingfran1907 | Uplifting Excursion (BOI22_vault) | C++14 | 5000 ms | 216780 KB |
#include <bits/stdc++.h> #define X first #define Y second using namespace std; typedef long long llint; const int maxn = 240; 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 | 80 ms | 216584 KB | Output is correct |
2 | Correct | 86 ms | 216752 KB | Output is correct |
3 | Correct | 85 ms | 216616 KB | Output is correct |
4 | Correct | 79 ms | 216604 KB | Output is correct |
5 | Correct | 578 ms | 216704 KB | Output is correct |
6 | Correct | 579 ms | 216704 KB | Output is correct |
7 | Correct | 176 ms | 216708 KB | Output is correct |
8 | Correct | 502 ms | 216708 KB | Output is correct |
9 | Correct | 1547 ms | 216780 KB | Output is correct |
10 | Correct | 95 ms | 216644 KB | Output is correct |
11 | Correct | 96 ms | 216636 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 80 ms | 216584 KB | Output is correct |
2 | Correct | 86 ms | 216752 KB | Output is correct |
3 | Correct | 85 ms | 216616 KB | Output is correct |
4 | Correct | 79 ms | 216604 KB | Output is correct |
5 | Correct | 578 ms | 216704 KB | Output is correct |
6 | Correct | 579 ms | 216704 KB | Output is correct |
7 | Correct | 176 ms | 216708 KB | Output is correct |
8 | Correct | 502 ms | 216708 KB | Output is correct |
9 | Correct | 1547 ms | 216780 KB | Output is correct |
10 | Correct | 95 ms | 216644 KB | Output is correct |
11 | Correct | 96 ms | 216636 KB | Output is correct |
12 | Correct | 80 ms | 216620 KB | Output is correct |
13 | Correct | 88 ms | 216684 KB | Output is correct |
14 | Correct | 82 ms | 216664 KB | Output is correct |
15 | Correct | 89 ms | 216616 KB | Output is correct |
16 | Correct | 550 ms | 216708 KB | Output is correct |
17 | Correct | 557 ms | 216708 KB | Output is correct |
18 | Correct | 192 ms | 216708 KB | Output is correct |
19 | Correct | 500 ms | 216712 KB | Output is correct |
20 | Correct | 1513 ms | 216712 KB | Output is correct |
21 | Correct | 79 ms | 216632 KB | Output is correct |
22 | Correct | 87 ms | 216592 KB | Output is correct |
23 | Execution timed out | 5070 ms | 216604 KB | Time limit exceeded |
24 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 86 ms | 216688 KB | Output is correct |
2 | Incorrect | 96 ms | 216604 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 86 ms | 216688 KB | Output is correct |
2 | Incorrect | 96 ms | 216604 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 86 ms | 216688 KB | Output is correct |
2 | Incorrect | 96 ms | 216604 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 80 ms | 216584 KB | Output is correct |
2 | Correct | 86 ms | 216752 KB | Output is correct |
3 | Correct | 85 ms | 216616 KB | Output is correct |
4 | Correct | 79 ms | 216604 KB | Output is correct |
5 | Correct | 578 ms | 216704 KB | Output is correct |
6 | Correct | 579 ms | 216704 KB | Output is correct |
7 | Correct | 176 ms | 216708 KB | Output is correct |
8 | Correct | 502 ms | 216708 KB | Output is correct |
9 | Correct | 1547 ms | 216780 KB | Output is correct |
10 | Correct | 95 ms | 216644 KB | Output is correct |
11 | Correct | 96 ms | 216636 KB | Output is correct |
12 | Correct | 86 ms | 216688 KB | Output is correct |
13 | Incorrect | 96 ms | 216604 KB | Output isn't correct |
14 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 86 ms | 216688 KB | Output is correct |
2 | Incorrect | 96 ms | 216604 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 80 ms | 216584 KB | Output is correct |
2 | Correct | 86 ms | 216752 KB | Output is correct |
3 | Correct | 85 ms | 216616 KB | Output is correct |
4 | Correct | 79 ms | 216604 KB | Output is correct |
5 | Correct | 578 ms | 216704 KB | Output is correct |
6 | Correct | 579 ms | 216704 KB | Output is correct |
7 | Correct | 176 ms | 216708 KB | Output is correct |
8 | Correct | 502 ms | 216708 KB | Output is correct |
9 | Correct | 1547 ms | 216780 KB | Output is correct |
10 | Correct | 95 ms | 216644 KB | Output is correct |
11 | Correct | 96 ms | 216636 KB | Output is correct |
12 | Correct | 80 ms | 216620 KB | Output is correct |
13 | Correct | 88 ms | 216684 KB | Output is correct |
14 | Correct | 82 ms | 216664 KB | Output is correct |
15 | Correct | 89 ms | 216616 KB | Output is correct |
16 | Correct | 550 ms | 216708 KB | Output is correct |
17 | Correct | 557 ms | 216708 KB | Output is correct |
18 | Correct | 192 ms | 216708 KB | Output is correct |
19 | Correct | 500 ms | 216712 KB | Output is correct |
20 | Correct | 1513 ms | 216712 KB | Output is correct |
21 | Correct | 79 ms | 216632 KB | Output is correct |
22 | Correct | 87 ms | 216592 KB | Output is correct |
23 | Execution timed out | 5070 ms | 216604 KB | Time limit exceeded |
24 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 86 ms | 216688 KB | Output is correct |
2 | Incorrect | 96 ms | 216604 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 80 ms | 216584 KB | Output is correct |
2 | Correct | 86 ms | 216752 KB | Output is correct |
3 | Correct | 85 ms | 216616 KB | Output is correct |
4 | Correct | 79 ms | 216604 KB | Output is correct |
5 | Correct | 578 ms | 216704 KB | Output is correct |
6 | Correct | 579 ms | 216704 KB | Output is correct |
7 | Correct | 176 ms | 216708 KB | Output is correct |
8 | Correct | 502 ms | 216708 KB | Output is correct |
9 | Correct | 1547 ms | 216780 KB | Output is correct |
10 | Correct | 95 ms | 216644 KB | Output is correct |
11 | Correct | 96 ms | 216636 KB | Output is correct |
12 | Correct | 80 ms | 216620 KB | Output is correct |
13 | Correct | 88 ms | 216684 KB | Output is correct |
14 | Correct | 82 ms | 216664 KB | Output is correct |
15 | Correct | 89 ms | 216616 KB | Output is correct |
16 | Correct | 550 ms | 216708 KB | Output is correct |
17 | Correct | 557 ms | 216708 KB | Output is correct |
18 | Correct | 192 ms | 216708 KB | Output is correct |
19 | Correct | 500 ms | 216712 KB | Output is correct |
20 | Correct | 1513 ms | 216712 KB | Output is correct |
21 | Correct | 79 ms | 216632 KB | Output is correct |
22 | Correct | 87 ms | 216592 KB | Output is correct |
23 | Execution timed out | 5070 ms | 216604 KB | Time limit exceeded |
24 | Halted | 0 ms | 0 KB | - |