Submission #70782673


Source Code Expand

#include<bits/stdc++.h>
typedef long long ll;
using namespace std;

int main(){
    int n;
    cin >> n;
    ll W[n], H[n], B[n];
    for(int i = 0; i < n; i++) cin >> W[i] >> H[i] >> B[i];

    ll sum = 0;
    for(int i = 0; i < n; i++) sum += W[i];

    ll W_max = sum / 2 + 1;
    vector<vector<ll>> dp(n+1, vector<ll>(W_max, 0));

    for(int i = 0; i < n; i++){
        for(int j = 0; j < W_max; j++){
            dp[i+1][j] = dp[i][j] + B[i];
            if(j-W[i] >= 0) dp[i+1][j] = max(dp[i+1][j], dp[i][j-W[i]] + H[i]);
        }
    }

    ll ans = 0;
    for(int i = 0; i < W_max; i++) ans = max(ans, dp[n][i]);
    cout << ans << endl;
}

Submission Info

Submission Time
Task D - Robot Customize
User sakimori_coder
Language C++23 (GCC 15.2.0)
Score 400
Code Size 675 Byte
Status AC
Exec Time 292 ms
Memory 495296 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 4
AC × 54
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt, 01_random_20.txt, 01_random_21.txt, 01_random_22.txt, 01_random_23.txt, 01_random_24.txt, 01_random_25.txt, 01_random_26.txt, 01_random_27.txt, 01_random_28.txt, 01_random_29.txt, 01_random_30.txt, 01_random_31.txt, 01_random_32.txt, 01_random_33.txt, 01_random_34.txt, 01_random_35.txt, 01_random_36.txt, 01_random_37.txt, 01_random_38.txt, 01_random_39.txt, 01_random_40.txt, 01_random_41.txt, 01_random_42.txt, 01_random_43.txt, 01_random_44.txt, 01_random_45.txt, 01_random_46.txt, 01_random_47.txt, 01_random_48.txt, 01_random_49.txt, 01_random_50.txt, 01_random_51.txt, 01_random_52.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3576 KiB
00_sample_01.txt AC 1 ms 3460 KiB
00_sample_02.txt AC 1 ms 3560 KiB
00_sample_03.txt AC 1 ms 3900 KiB
01_random_03.txt AC 145 ms 246312 KiB
01_random_04.txt AC 145 ms 246320 KiB
01_random_05.txt AC 147 ms 252348 KiB
01_random_06.txt AC 147 ms 250300 KiB
01_random_07.txt AC 150 ms 254264 KiB
01_random_08.txt AC 149 ms 252232 KiB
01_random_09.txt AC 146 ms 248256 KiB
01_random_10.txt AC 150 ms 252352 KiB
01_random_11.txt AC 148 ms 252352 KiB
01_random_12.txt AC 92 ms 158024 KiB
01_random_13.txt AC 32 ms 56884 KiB
01_random_14.txt AC 26 ms 46444 KiB
01_random_15.txt AC 51 ms 90016 KiB
01_random_16.txt AC 18 ms 32696 KiB
01_random_17.txt AC 146 ms 246308 KiB
01_random_18.txt AC 151 ms 256296 KiB
01_random_19.txt AC 148 ms 250228 KiB
01_random_20.txt AC 142 ms 242292 KiB
01_random_21.txt AC 144 ms 246228 KiB
01_random_22.txt AC 29 ms 50104 KiB
01_random_23.txt AC 1 ms 3880 KiB
01_random_24.txt AC 1 ms 3532 KiB
01_random_25.txt AC 147 ms 250216 KiB
01_random_26.txt AC 153 ms 258368 KiB
01_random_27.txt AC 144 ms 246260 KiB
01_random_28.txt AC 150 ms 254244 KiB
01_random_29.txt AC 152 ms 256320 KiB
01_random_30.txt AC 152 ms 258216 KiB
01_random_31.txt AC 106 ms 183076 KiB
01_random_32.txt AC 51 ms 89460 KiB
01_random_33.txt AC 1 ms 3460 KiB
01_random_34.txt AC 1 ms 3528 KiB
01_random_35.txt AC 146 ms 248232 KiB
01_random_36.txt AC 145 ms 244280 KiB
01_random_37.txt AC 150 ms 256248 KiB
01_random_38.txt AC 142 ms 242172 KiB
01_random_39.txt AC 150 ms 254188 KiB
01_random_40.txt AC 146 ms 248240 KiB
01_random_41.txt AC 147 ms 252232 KiB
01_random_42.txt AC 145 ms 248232 KiB
01_random_43.txt AC 55 ms 96840 KiB
01_random_44.txt AC 124 ms 213564 KiB
01_random_45.txt AC 99 ms 170556 KiB
01_random_46.txt AC 6 ms 12076 KiB
01_random_47.txt AC 38 ms 67260 KiB
01_random_48.txt AC 291 ms 495176 KiB
01_random_49.txt AC 290 ms 495296 KiB
01_random_50.txt AC 292 ms 495224 KiB
01_random_51.txt AC 5 ms 9904 KiB
01_random_52.txt AC 47 ms 85608 KiB