Submission #573690

# Submission time Handle Problem Language Result Execution time Memory
573690 2022-06-07T05:19:19 Z eecs Uplifting Excursion (BOI22_vault) C++17
20 / 100
43 ms 400 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

int main() {
    ios::sync_with_stdio(0), cin.tie(0);
    int m;
    ll L;
    cin >> m >> L;
    vector<ll> a(m + 1);
    for (int i = -m; i <= m; i++) {
        if (i < 0) cin >> *new ll;
        else cin >> a[i];
    }
    ll lim = 5000, ans = 0;
    for (int i = 0; i <= m; i++) {
        ll t = max(0LL, min(a[i], !i ? LLONG_MAX : (L - lim) / i));
        ans += t, L -= i * t, a[i] -= t;
    }
    L = min(L, lim + m);
    vector<ll> f(L + 1, -1e18);
    f[0] = 0;
    for (int i = 1; i <= m; i++) {
        vector<ll> g(L + 1, -1e18);
        for (int j = 0; j <= L; j++) {
            for (int k = 0; k <= a[i] && j + i * k <= L; k++) {
                g[j + i * k] = max(g[j + i * k], f[j] + k);
            }
        }
        swap(f, g);
    }
    if (f[L] < 0) cout << "impossible\n";
    else cout << ans + f[L] << "\n";
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 10 ms 340 KB Output is correct
5 Correct 4 ms 392 KB Output is correct
6 Correct 38 ms 340 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 4 ms 340 KB Output is correct
10 Correct 4 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 10 ms 340 KB Output is correct
5 Correct 4 ms 392 KB Output is correct
6 Correct 38 ms 340 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 4 ms 340 KB Output is correct
10 Correct 4 ms 340 KB Output is correct
11 Incorrect 0 ms 212 KB Output isn't correct
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 10 ms 340 KB Output is correct
5 Correct 4 ms 392 KB Output is correct
6 Correct 38 ms 340 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 4 ms 340 KB Output is correct
10 Correct 4 ms 340 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 2 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 13 ms 392 KB Output is correct
15 Correct 3 ms 392 KB Output is correct
16 Correct 38 ms 392 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 5 ms 340 KB Output is correct
20 Correct 4 ms 400 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 3 ms 340 KB Output is correct
24 Correct 2 ms 340 KB Output is correct
25 Correct 2 ms 340 KB Output is correct
26 Correct 13 ms 396 KB Output is correct
27 Correct 28 ms 384 KB Output is correct
28 Correct 3 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 10 ms 340 KB Output is correct
5 Correct 4 ms 392 KB Output is correct
6 Correct 38 ms 340 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 4 ms 340 KB Output is correct
10 Correct 4 ms 340 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 2 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 13 ms 392 KB Output is correct
15 Correct 3 ms 392 KB Output is correct
16 Correct 38 ms 392 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 5 ms 340 KB Output is correct
20 Correct 4 ms 400 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 3 ms 340 KB Output is correct
24 Correct 2 ms 340 KB Output is correct
25 Correct 2 ms 340 KB Output is correct
26 Correct 13 ms 396 KB Output is correct
27 Correct 28 ms 384 KB Output is correct
28 Correct 3 ms 340 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 3 ms 340 KB Output is correct
31 Correct 3 ms 340 KB Output is correct
32 Correct 13 ms 392 KB Output is correct
33 Correct 6 ms 340 KB Output is correct
34 Correct 43 ms 340 KB Output is correct
35 Correct 1 ms 212 KB Output is correct
36 Correct 0 ms 232 KB Output is correct
37 Correct 5 ms 340 KB Output is correct
38 Correct 2 ms 340 KB Output is correct
39 Correct 1 ms 340 KB Output is correct
40 Correct 1 ms 340 KB Output is correct
41 Correct 2 ms 340 KB Output is correct
42 Correct 2 ms 340 KB Output is correct
43 Correct 2 ms 340 KB Output is correct
44 Correct 14 ms 340 KB Output is correct
45 Correct 31 ms 340 KB Output is correct
46 Correct 4 ms 340 KB Output is correct
47 Incorrect 3 ms 340 KB Output isn't correct
48 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 10 ms 340 KB Output is correct
5 Correct 4 ms 392 KB Output is correct
6 Correct 38 ms 340 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 4 ms 340 KB Output is correct
10 Correct 4 ms 340 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 2 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 13 ms 392 KB Output is correct
15 Correct 3 ms 392 KB Output is correct
16 Correct 38 ms 392 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 5 ms 340 KB Output is correct
20 Correct 4 ms 400 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 3 ms 340 KB Output is correct
24 Correct 2 ms 340 KB Output is correct
25 Correct 2 ms 340 KB Output is correct
26 Correct 13 ms 396 KB Output is correct
27 Correct 28 ms 384 KB Output is correct
28 Correct 3 ms 340 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 3 ms 340 KB Output is correct
31 Correct 3 ms 340 KB Output is correct
32 Correct 13 ms 392 KB Output is correct
33 Correct 6 ms 340 KB Output is correct
34 Correct 43 ms 340 KB Output is correct
35 Correct 1 ms 212 KB Output is correct
36 Correct 0 ms 232 KB Output is correct
37 Correct 5 ms 340 KB Output is correct
38 Correct 2 ms 340 KB Output is correct
39 Correct 1 ms 340 KB Output is correct
40 Correct 1 ms 340 KB Output is correct
41 Correct 2 ms 340 KB Output is correct
42 Correct 2 ms 340 KB Output is correct
43 Correct 2 ms 340 KB Output is correct
44 Correct 14 ms 340 KB Output is correct
45 Correct 31 ms 340 KB Output is correct
46 Correct 4 ms 340 KB Output is correct
47 Incorrect 3 ms 340 KB Output isn't correct
48 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -