結果

問題 No.2730 Two Types Luggage
ユーザー かもめのうでかもめのうで
提出日時 2024-04-20 00:57:58
言語 Rust
(1.77.0)
結果
AC  
実行時間 249 ms / 2,000 ms
コード長 745 bytes
コンパイル時間 3,273 ms
コンパイル使用メモリ 172,256 KB
実行使用メモリ 29,232 KB
最終ジャッジ日時 2024-04-20 00:58:14
合計ジャッジ時間 8,621 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 1 ms
6,940 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 6 ms
6,940 KB
testcase_05 AC 1 ms
6,940 KB
testcase_06 AC 0 ms
6,940 KB
testcase_07 AC 1 ms
6,944 KB
testcase_08 AC 1 ms
6,944 KB
testcase_09 AC 2 ms
6,944 KB
testcase_10 AC 5 ms
6,940 KB
testcase_11 AC 104 ms
23,384 KB
testcase_12 AC 211 ms
28,776 KB
testcase_13 AC 83 ms
18,920 KB
testcase_14 AC 105 ms
22,612 KB
testcase_15 AC 124 ms
7,272 KB
testcase_16 AC 41 ms
9,660 KB
testcase_17 AC 134 ms
27,940 KB
testcase_18 AC 120 ms
26,704 KB
testcase_19 AC 11 ms
6,940 KB
testcase_20 AC 48 ms
11,628 KB
testcase_21 AC 100 ms
23,140 KB
testcase_22 AC 134 ms
28,688 KB
testcase_23 AC 16 ms
6,940 KB
testcase_24 AC 58 ms
13,220 KB
testcase_25 AC 105 ms
24,112 KB
testcase_26 AC 28 ms
7,608 KB
testcase_27 AC 97 ms
22,536 KB
testcase_28 AC 53 ms
12,496 KB
testcase_29 AC 139 ms
26,568 KB
testcase_30 AC 88 ms
6,944 KB
testcase_31 AC 82 ms
18,528 KB
testcase_32 AC 70 ms
16,036 KB
testcase_33 AC 209 ms
29,188 KB
testcase_34 AC 213 ms
29,204 KB
testcase_35 AC 214 ms
29,232 KB
testcase_36 AC 249 ms
29,144 KB
testcase_37 AC 225 ms
29,208 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#![allow(unused)]
use proconio::*;
use std::collections::*;

fn main() {
    input! {
        n: usize, m: usize, w: usize,
        mut a: [usize; n],
        b: [usize; m],
        c: [usize; m]
    }
    a.sort_by(|a, b| b.cmp(a));
    let mut rui = vec![0];
    for ai in a {
        rui.push(rui[rui.len()-1]+ai)
    }

    let mut ans = 0;
    for bit in 0..1<<m {
        let mut val_cnt = 0;
        let mut weight_cnt = 0;
        for i in 0..m {
            if bit&1<<i > 0 {
                val_cnt += c[i];
                weight_cnt += b[i];
            }
        }
        if weight_cnt > w {
            continue;
        }
        val_cnt += rui[(w-weight_cnt).min(n)];
        ans = ans.max(val_cnt)
    }
    println!("{ans}")
}
0