답안 #573695

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
573695 2022-06-07T05:28:48 Z eecs Uplifting Excursion (BOI22_vault) C++17
0 / 100
3704 ms 2388 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 = 20000, ans = a[0];
    for (int i = 1; i <= m; i++) {
        ll t = max(0LL, min(a[i] - lim / 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;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 3704 ms 2388 KB Output is correct
3 Correct 201 ms 920 KB Output is correct
4 Incorrect 421 ms 448 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 3704 ms 2388 KB Output is correct
3 Correct 201 ms 920 KB Output is correct
4 Incorrect 421 ms 448 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 3704 ms 2388 KB Output is correct
3 Correct 201 ms 920 KB Output is correct
4 Incorrect 421 ms 448 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 3704 ms 2388 KB Output is correct
3 Correct 201 ms 920 KB Output is correct
4 Incorrect 421 ms 448 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 3704 ms 2388 KB Output is correct
3 Correct 201 ms 920 KB Output is correct
4 Incorrect 421 ms 448 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -