# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
577816 | 2022-06-15T09:30:57 Z | kingfran1907 | Uplifting Excursion (BOI22_vault) | C++14 | 5000 ms | 244940 KB |
#include <bits/stdc++.h> #define X first #define Y second using namespace std; typedef long long llint; const int maxn = 250; 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 | 94 ms | 244884 KB | Output is correct |
2 | Correct | 90 ms | 244880 KB | Output is correct |
3 | Correct | 91 ms | 244912 KB | Output is correct |
4 | Correct | 104 ms | 244872 KB | Output is correct |
5 | Correct | 561 ms | 244904 KB | Output is correct |
6 | Correct | 601 ms | 244900 KB | Output is correct |
7 | Correct | 174 ms | 244904 KB | Output is correct |
8 | Correct | 504 ms | 244812 KB | Output is correct |
9 | Correct | 1529 ms | 244900 KB | Output is correct |
10 | Correct | 91 ms | 244812 KB | Output is correct |
11 | Correct | 88 ms | 244816 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 94 ms | 244884 KB | Output is correct |
2 | Correct | 90 ms | 244880 KB | Output is correct |
3 | Correct | 91 ms | 244912 KB | Output is correct |
4 | Correct | 104 ms | 244872 KB | Output is correct |
5 | Correct | 561 ms | 244904 KB | Output is correct |
6 | Correct | 601 ms | 244900 KB | Output is correct |
7 | Correct | 174 ms | 244904 KB | Output is correct |
8 | Correct | 504 ms | 244812 KB | Output is correct |
9 | Correct | 1529 ms | 244900 KB | Output is correct |
10 | Correct | 91 ms | 244812 KB | Output is correct |
11 | Correct | 88 ms | 244816 KB | Output is correct |
12 | Correct | 88 ms | 244816 KB | Output is correct |
13 | Correct | 91 ms | 244832 KB | Output is correct |
14 | Correct | 86 ms | 244848 KB | Output is correct |
15 | Correct | 89 ms | 244872 KB | Output is correct |
16 | Correct | 554 ms | 244920 KB | Output is correct |
17 | Correct | 563 ms | 244908 KB | Output is correct |
18 | Correct | 175 ms | 244940 KB | Output is correct |
19 | Correct | 499 ms | 244844 KB | Output is correct |
20 | Correct | 1493 ms | 244900 KB | Output is correct |
21 | Correct | 88 ms | 244900 KB | Output is correct |
22 | Correct | 90 ms | 244864 KB | Output is correct |
23 | Execution timed out | 5067 ms | 244788 KB | Time limit exceeded |
24 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 87 ms | 244812 KB | Output is correct |
2 | Incorrect | 88 ms | 244888 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 87 ms | 244812 KB | Output is correct |
2 | Incorrect | 88 ms | 244888 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 87 ms | 244812 KB | Output is correct |
2 | Incorrect | 88 ms | 244888 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 94 ms | 244884 KB | Output is correct |
2 | Correct | 90 ms | 244880 KB | Output is correct |
3 | Correct | 91 ms | 244912 KB | Output is correct |
4 | Correct | 104 ms | 244872 KB | Output is correct |
5 | Correct | 561 ms | 244904 KB | Output is correct |
6 | Correct | 601 ms | 244900 KB | Output is correct |
7 | Correct | 174 ms | 244904 KB | Output is correct |
8 | Correct | 504 ms | 244812 KB | Output is correct |
9 | Correct | 1529 ms | 244900 KB | Output is correct |
10 | Correct | 91 ms | 244812 KB | Output is correct |
11 | Correct | 88 ms | 244816 KB | Output is correct |
12 | Correct | 87 ms | 244812 KB | Output is correct |
13 | Incorrect | 88 ms | 244888 KB | Output isn't correct |
14 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 87 ms | 244812 KB | Output is correct |
2 | Incorrect | 88 ms | 244888 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 94 ms | 244884 KB | Output is correct |
2 | Correct | 90 ms | 244880 KB | Output is correct |
3 | Correct | 91 ms | 244912 KB | Output is correct |
4 | Correct | 104 ms | 244872 KB | Output is correct |
5 | Correct | 561 ms | 244904 KB | Output is correct |
6 | Correct | 601 ms | 244900 KB | Output is correct |
7 | Correct | 174 ms | 244904 KB | Output is correct |
8 | Correct | 504 ms | 244812 KB | Output is correct |
9 | Correct | 1529 ms | 244900 KB | Output is correct |
10 | Correct | 91 ms | 244812 KB | Output is correct |
11 | Correct | 88 ms | 244816 KB | Output is correct |
12 | Correct | 88 ms | 244816 KB | Output is correct |
13 | Correct | 91 ms | 244832 KB | Output is correct |
14 | Correct | 86 ms | 244848 KB | Output is correct |
15 | Correct | 89 ms | 244872 KB | Output is correct |
16 | Correct | 554 ms | 244920 KB | Output is correct |
17 | Correct | 563 ms | 244908 KB | Output is correct |
18 | Correct | 175 ms | 244940 KB | Output is correct |
19 | Correct | 499 ms | 244844 KB | Output is correct |
20 | Correct | 1493 ms | 244900 KB | Output is correct |
21 | Correct | 88 ms | 244900 KB | Output is correct |
22 | Correct | 90 ms | 244864 KB | Output is correct |
23 | Execution timed out | 5067 ms | 244788 KB | Time limit exceeded |
24 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 87 ms | 244812 KB | Output is correct |
2 | Incorrect | 88 ms | 244888 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 94 ms | 244884 KB | Output is correct |
2 | Correct | 90 ms | 244880 KB | Output is correct |
3 | Correct | 91 ms | 244912 KB | Output is correct |
4 | Correct | 104 ms | 244872 KB | Output is correct |
5 | Correct | 561 ms | 244904 KB | Output is correct |
6 | Correct | 601 ms | 244900 KB | Output is correct |
7 | Correct | 174 ms | 244904 KB | Output is correct |
8 | Correct | 504 ms | 244812 KB | Output is correct |
9 | Correct | 1529 ms | 244900 KB | Output is correct |
10 | Correct | 91 ms | 244812 KB | Output is correct |
11 | Correct | 88 ms | 244816 KB | Output is correct |
12 | Correct | 88 ms | 244816 KB | Output is correct |
13 | Correct | 91 ms | 244832 KB | Output is correct |
14 | Correct | 86 ms | 244848 KB | Output is correct |
15 | Correct | 89 ms | 244872 KB | Output is correct |
16 | Correct | 554 ms | 244920 KB | Output is correct |
17 | Correct | 563 ms | 244908 KB | Output is correct |
18 | Correct | 175 ms | 244940 KB | Output is correct |
19 | Correct | 499 ms | 244844 KB | Output is correct |
20 | Correct | 1493 ms | 244900 KB | Output is correct |
21 | Correct | 88 ms | 244900 KB | Output is correct |
22 | Correct | 90 ms | 244864 KB | Output is correct |
23 | Execution timed out | 5067 ms | 244788 KB | Time limit exceeded |
24 | Halted | 0 ms | 0 KB | - |