結果

問題 No.2730 Two Types Luggage
ユーザー Yukino DX.Yukino DX.
提出日時 2024-04-19 21:41:34
言語 Rust
(1.77.0)
結果
AC  
実行時間 224 ms / 2,000 ms
コード長 828 bytes
コンパイル時間 2,476 ms
コンパイル使用メモリ 169,668 KB
実行使用メモリ 27,276 KB
最終ジャッジ日時 2024-04-19 21:41:56
合計ジャッジ時間 7,839 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 0 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 2 ms
5,376 KB
testcase_10 AC 5 ms
5,376 KB
testcase_11 AC 104 ms
20,764 KB
testcase_12 AC 215 ms
26,840 KB
testcase_13 AC 84 ms
16,876 KB
testcase_14 AC 123 ms
20,704 KB
testcase_15 AC 98 ms
6,764 KB
testcase_16 AC 38 ms
8,764 KB
testcase_17 AC 133 ms
25,904 KB
testcase_18 AC 122 ms
24,004 KB
testcase_19 AC 11 ms
5,376 KB
testcase_20 AC 49 ms
10,732 KB
testcase_21 AC 99 ms
19,592 KB
testcase_22 AC 136 ms
26,672 KB
testcase_23 AC 16 ms
5,376 KB
testcase_24 AC 58 ms
12,280 KB
testcase_25 AC 106 ms
20,956 KB
testcase_26 AC 29 ms
7,048 KB
testcase_27 AC 98 ms
19,624 KB
testcase_28 AC 54 ms
11,728 KB
testcase_29 AC 122 ms
24,096 KB
testcase_30 AC 98 ms
5,376 KB
testcase_31 AC 83 ms
16,592 KB
testcase_32 AC 72 ms
15,136 KB
testcase_33 AC 212 ms
27,272 KB
testcase_34 AC 214 ms
27,272 KB
testcase_35 AC 220 ms
27,276 KB
testcase_36 AC 224 ms
27,264 KB
testcase_37 AC 218 ms
27,168 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#![allow(unused_imports)]
//use itertools::{iproduct, Itertools};
use proconio::input;
use proconio::marker::*;
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 cum_a = vec![0;n+1];
    for i in 0..n{
        cum_a[i+1]=cum_a[i]+a[i];
    }

    let mut ans = 0;
    for i in 0..1 << m {
        let mut sum_v = 0;
        let mut sum_w = 0;
        for j in 0..m {
            if i & (1 << j) == 0 {
                continue;
            }

            sum_v += c[j];
            sum_w += b[j];
        }

        if sum_w <= w {
            sum_v += cum_a[(w - sum_w).min(n)];
            ans = ans.max(sum_v);
        }
    }

    println!("{}", ans);
}
0