結果

問題 No.2730 Two Types Luggage
ユーザー かもめのうでかもめのうで
提出日時 2024-04-20 01:00:37
言語 Rust
(1.77.0)
結果
AC  
実行時間 260 ms / 2,000 ms
コード長 809 bytes
コンパイル時間 5,564 ms
コンパイル使用メモリ 162,304 KB
実行使用メモリ 37,004 KB
最終ジャッジ日時 2024-04-20 01:00:49
合計ジャッジ時間 6,610 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 5 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 3 ms
5,376 KB
testcase_10 AC 6 ms
5,376 KB
testcase_11 AC 109 ms
28,568 KB
testcase_12 AC 229 ms
36,612 KB
testcase_13 AC 98 ms
23,460 KB
testcase_14 AC 110 ms
28,548 KB
testcase_15 AC 113 ms
8,812 KB
testcase_16 AC 38 ms
11,960 KB
testcase_17 AC 134 ms
35,260 KB
testcase_18 AC 126 ms
32,708 KB
testcase_19 AC 11 ms
5,376 KB
testcase_20 AC 53 ms
14,320 KB
testcase_21 AC 103 ms
27,276 KB
testcase_22 AC 145 ms
36,316 KB
testcase_23 AC 18 ms
5,376 KB
testcase_24 AC 61 ms
16,380 KB
testcase_25 AC 128 ms
29,000 KB
testcase_26 AC 31 ms
9,144 KB
testcase_27 AC 110 ms
27,308 KB
testcase_28 AC 59 ms
15,576 KB
testcase_29 AC 139 ms
32,952 KB
testcase_30 AC 110 ms
5,376 KB
testcase_31 AC 87 ms
23,060 KB
testcase_32 AC 79 ms
20,000 KB
testcase_33 AC 240 ms
36,960 KB
testcase_34 AC 260 ms
36,956 KB
testcase_35 AC 245 ms
36,908 KB
testcase_36 AC 236 ms
37,004 KB
testcase_37 AC 238 ms
36,844 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#![allow(unused)]
// use itertools::Itertools;
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();
    let a = a.iter().rev().collect::<Vec<&usize>>();
    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