답안 #579701

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
579701 2022-06-19T16:13:37 Z Josia Uplifting Excursion (BOI22_vault) C++14
0 / 100
472 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;
    }


    cout << dp[target] << "\n";

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 25 ms 348 KB Output is correct
2 Runtime error 472 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 25 ms 348 KB Output is correct
2 Runtime error 472 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 25 ms 348 KB Output is correct
2 Runtime error 472 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 25 ms 348 KB Output is correct
2 Runtime error 472 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 25 ms 348 KB Output is correct
2 Runtime error 472 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -