163352025-04-28 17:46:21algoproJobstown-i milliomoscpp17Wrong answer 0/100246ms262144 KiB
// UUID: 70eab023-e648-4dcd-a33c-6a08a9a40df8
#include <bits/stdc++.h>
using namespace std;

void solve() {
    int n, m;
    cin >> n >> m;
    vector<pair<int, int>> tasks(n);

    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        
        tasks[i].second = a;
    }

    for (int i = 0; i < n; i++) {
        int b;
        cin >> b;
        
        tasks[i].first = b;
    }

    vector<int> dp(m + 1, 0);

    for (int curr = 1; curr <= m; curr++) {
        for (const auto& task : tasks) {
            if (task.second <= curr) {
                dp[curr] = max(dp[curr], dp[curr - task.second] + task.first);
            }
        }
    }

    cout << dp[m];
    return;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1;
    //cin >> t;

    while (t--) {
        solve();
    }

    return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted1ms316 KiB
2Accepted1ms316 KiB
subtask20/25
3Accepted1ms316 KiB
4Accepted1ms316 KiB
5Wrong answer76ms564 KiB
6Wrong answer76ms564 KiB
7Wrong answer76ms564 KiB
8Wrong answer76ms564 KiB
9Wrong answer76ms760 KiB
10Wrong answer76ms756 KiB
11Wrong answer76ms564 KiB
12Wrong answer78ms564 KiB
13Wrong answer76ms568 KiB
14Wrong answer1ms748 KiB
subtask30/16
15Runtime error243ms262144 KiB
16Runtime error202ms262144 KiB
17Runtime error200ms262144 KiB
18Runtime error246ms262144 KiB
19Runtime error201ms262144 KiB
20Runtime error201ms262144 KiB
21Runtime error245ms262144 KiB
subtask40/59
22Accepted1ms316 KiB
23Accepted1ms548 KiB
24Runtime error200ms262144 KiB
25Runtime error201ms262144 KiB
26Runtime error244ms262144 KiB
27Runtime error241ms262144 KiB
28Runtime error204ms262144 KiB
29Runtime error199ms262144 KiB
30Runtime error244ms262144 KiB
31Runtime error246ms262144 KiB
32Runtime error209ms262144 KiB
33Runtime error196ms262144 KiB