Submission #579703

# Submission time Handle Problem Language Result Execution time Memory
579703 2022-06-19T16:14:53 Z Josia Uplifting Excursion (BOI22_vault) C++14
0 / 100
5000 ms 524288 KB
#include <bits/stdc++.h>

using namespace std;

#define int int64_t

signed main() {
    cin.tie(0);
    ios_base::sync_with_stdio(0);

    int n, target; cin >> n >> target;

    vector<int> coins(2*n+1);

    for (int i = 0; i<2*n+1; i++) cin >> coins[i];


    vector<int> coinsEXPL;

    for (int i = 0; i<2*n+1; i++) {
        for (int j = 0; j<coins[i]; j++) coinsEXPL.push_back(i-n);
    }

    map<int, int> dp;
    dp[0] = 0;

    for (int i: coinsEXPL) {
        map<int, int> newDP = dp;
        for (auto j: dp) {
            cerr << j.first << " " << j.second << "\n";
            newDP[j.first+i] = max(j.second+1, newDP[j.first+i]);
        }
        dp = newDP;
    }


    if (dp.count(target)) cout << dp[target] << "\n";
    else cout << "impossible\n";

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 30 ms 352 KB Output is correct
5 Execution timed out 5079 ms 9872 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 30 ms 352 KB Output is correct
5 Execution timed out 5079 ms 9872 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 23 ms 340 KB Output is correct
2 Runtime error 478 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 23 ms 340 KB Output is correct
2 Runtime error 478 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 23 ms 340 KB Output is correct
2 Runtime error 478 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 30 ms 352 KB Output is correct
5 Execution timed out 5079 ms 9872 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 23 ms 340 KB Output is correct
2 Runtime error 478 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 30 ms 352 KB Output is correct
5 Execution timed out 5079 ms 9872 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 23 ms 340 KB Output is correct
2 Runtime error 478 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 30 ms 352 KB Output is correct
5 Execution timed out 5079 ms 9872 KB Time limit exceeded
6 Halted 0 ms 0 KB -