Submission #573693

# Submission time Handle Problem Language Result Execution time Memory
573693 2022-06-07T05:22:58 Z eecs Uplifting Excursion (BOI22_vault) C++17
20 / 100
665 ms 544 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, all = 0;
    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], all += i * a[i];
    }
    if (all < L) cout << "impossible\n", exit(0);
    ll lim = 30000, ans = a[0];
    for (int i = 1; i <= m; i++) {
        ll t = max(0LL, min(a[i], (L - lim) / i));
        ans += t, L -= i * t, a[i] -= t;
    }
    vector<int> f(L + 1, -1e9);
    f[0] = 0;
    for (int i = 1; i <= m; i++) {
        vector<int> g(L + 1, -1e9);
        for (int j = 0; j <= L; j++) if (f[j] >= 0) {
            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 3 ms 468 KB Output is correct
3 Correct 2 ms 468 KB Output is correct
4 Correct 172 ms 468 KB Output is correct
5 Correct 38 ms 544 KB Output is correct
6 Correct 482 ms 528 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 7 ms 468 KB Output is correct
10 Correct 2 ms 440 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 3 ms 468 KB Output is correct
3 Correct 2 ms 468 KB Output is correct
4 Correct 172 ms 468 KB Output is correct
5 Correct 38 ms 544 KB Output is correct
6 Correct 482 ms 528 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 7 ms 468 KB Output is correct
10 Correct 2 ms 440 KB Output is correct
11 Incorrect 1 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 3 ms 468 KB Output is correct
3 Correct 2 ms 468 KB Output is correct
4 Correct 172 ms 468 KB Output is correct
5 Correct 38 ms 544 KB Output is correct
6 Correct 482 ms 528 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 7 ms 468 KB Output is correct
10 Correct 2 ms 440 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 5 ms 468 KB Output is correct
13 Correct 1 ms 468 KB Output is correct
14 Correct 170 ms 468 KB Output is correct
15 Correct 31 ms 468 KB Output is correct
16 Correct 511 ms 528 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 7 ms 468 KB Output is correct
20 Correct 3 ms 468 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 2 ms 468 KB Output is correct
24 Correct 2 ms 468 KB Output is correct
25 Correct 4 ms 468 KB Output is correct
26 Correct 248 ms 468 KB Output is correct
27 Correct 646 ms 532 KB Output is correct
28 Correct 23 ms 468 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 3 ms 468 KB Output is correct
3 Correct 2 ms 468 KB Output is correct
4 Correct 172 ms 468 KB Output is correct
5 Correct 38 ms 544 KB Output is correct
6 Correct 482 ms 528 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 7 ms 468 KB Output is correct
10 Correct 2 ms 440 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 5 ms 468 KB Output is correct
13 Correct 1 ms 468 KB Output is correct
14 Correct 170 ms 468 KB Output is correct
15 Correct 31 ms 468 KB Output is correct
16 Correct 511 ms 528 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 7 ms 468 KB Output is correct
20 Correct 3 ms 468 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 2 ms 468 KB Output is correct
24 Correct 2 ms 468 KB Output is correct
25 Correct 4 ms 468 KB Output is correct
26 Correct 248 ms 468 KB Output is correct
27 Correct 646 ms 532 KB Output is correct
28 Correct 23 ms 468 KB Output is correct
29 Correct 0 ms 212 KB Output is correct
30 Correct 3 ms 468 KB Output is correct
31 Correct 1 ms 468 KB Output is correct
32 Correct 174 ms 532 KB Output is correct
33 Correct 30 ms 468 KB Output is correct
34 Correct 491 ms 532 KB Output is correct
35 Correct 0 ms 212 KB Output is correct
36 Correct 0 ms 212 KB Output is correct
37 Correct 6 ms 468 KB Output is correct
38 Correct 2 ms 468 KB Output is correct
39 Correct 1 ms 212 KB Output is correct
40 Correct 0 ms 212 KB Output is correct
41 Correct 2 ms 468 KB Output is correct
42 Correct 1 ms 468 KB Output is correct
43 Correct 2 ms 468 KB Output is correct
44 Correct 245 ms 468 KB Output is correct
45 Correct 665 ms 528 KB Output is correct
46 Correct 22 ms 468 KB Output is correct
47 Correct 1 ms 340 KB Output is correct
48 Correct 1 ms 340 KB Output is correct
49 Incorrect 3 ms 468 KB Output isn't correct
50 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 3 ms 468 KB Output is correct
3 Correct 2 ms 468 KB Output is correct
4 Correct 172 ms 468 KB Output is correct
5 Correct 38 ms 544 KB Output is correct
6 Correct 482 ms 528 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 7 ms 468 KB Output is correct
10 Correct 2 ms 440 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 5 ms 468 KB Output is correct
13 Correct 1 ms 468 KB Output is correct
14 Correct 170 ms 468 KB Output is correct
15 Correct 31 ms 468 KB Output is correct
16 Correct 511 ms 528 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 7 ms 468 KB Output is correct
20 Correct 3 ms 468 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 2 ms 468 KB Output is correct
24 Correct 2 ms 468 KB Output is correct
25 Correct 4 ms 468 KB Output is correct
26 Correct 248 ms 468 KB Output is correct
27 Correct 646 ms 532 KB Output is correct
28 Correct 23 ms 468 KB Output is correct
29 Correct 0 ms 212 KB Output is correct
30 Correct 3 ms 468 KB Output is correct
31 Correct 1 ms 468 KB Output is correct
32 Correct 174 ms 532 KB Output is correct
33 Correct 30 ms 468 KB Output is correct
34 Correct 491 ms 532 KB Output is correct
35 Correct 0 ms 212 KB Output is correct
36 Correct 0 ms 212 KB Output is correct
37 Correct 6 ms 468 KB Output is correct
38 Correct 2 ms 468 KB Output is correct
39 Correct 1 ms 212 KB Output is correct
40 Correct 0 ms 212 KB Output is correct
41 Correct 2 ms 468 KB Output is correct
42 Correct 1 ms 468 KB Output is correct
43 Correct 2 ms 468 KB Output is correct
44 Correct 245 ms 468 KB Output is correct
45 Correct 665 ms 528 KB Output is correct
46 Correct 22 ms 468 KB Output is correct
47 Correct 1 ms 340 KB Output is correct
48 Correct 1 ms 340 KB Output is correct
49 Incorrect 3 ms 468 KB Output isn't correct
50 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 -