結果

問題 No.2730 Two Types Luggage
ユーザー ikomaikoma
提出日時 2024-04-19 22:14:12
言語 Rust
(1.77.0)
結果
AC  
実行時間 252 ms / 2,000 ms
コード長 1,945 bytes
コンパイル時間 1,618 ms
コンパイル使用メモリ 176,768 KB
実行使用メモリ 29,328 KB
最終ジャッジ日時 2024-04-19 22:14:24
合計ジャッジ時間 7,569 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,248 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 2 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 116 ms
22,692 KB
testcase_12 AC 235 ms
28,948 KB
testcase_13 AC 88 ms
18,864 KB
testcase_14 AC 112 ms
22,672 KB
testcase_15 AC 106 ms
7,292 KB
testcase_16 AC 40 ms
9,804 KB
testcase_17 AC 142 ms
27,956 KB
testcase_18 AC 144 ms
26,060 KB
testcase_19 AC 11 ms
5,376 KB
testcase_20 AC 53 ms
11,772 KB
testcase_21 AC 115 ms
21,656 KB
testcase_22 AC 173 ms
28,736 KB
testcase_23 AC 18 ms
5,376 KB
testcase_24 AC 64 ms
13,232 KB
testcase_25 AC 114 ms
23,000 KB
testcase_26 AC 30 ms
7,616 KB
testcase_27 AC 109 ms
21,688 KB
testcase_28 AC 56 ms
12,508 KB
testcase_29 AC 135 ms
26,164 KB
testcase_30 AC 91 ms
5,376 KB
testcase_31 AC 87 ms
18,532 KB
testcase_32 AC 77 ms
16,048 KB
testcase_33 AC 232 ms
29,328 KB
testcase_34 AC 230 ms
29,200 KB
testcase_35 AC 252 ms
29,204 KB
testcase_36 AC 236 ms
29,208 KB
testcase_37 AC 231 ms
29,208 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#![allow(unused_imports, dead_code, unused_macros, unused_variables, non_snake_case, unused_parens)]
use proconio::{input,marker::{Bytes, Chars, Usize1,Isize1}};
use std::cmp::*;
use std::mem::swap;
use std::collections::*;

const MOD:u64 = 998244353;
const INF:i64 = 0x3fff_ffff_ffff_ffff;

macro_rules! min {($a:expr $(,)*) => {{$a}};($a:expr, $b:expr $(,)*) => {{std::cmp::min($a, $b)}};($a:expr, $($rest:expr),+ $(,)*) => {{std::cmp::min($a, min!($($rest),+))}};}
macro_rules! max {($a:expr $(,)*) => {{$a}};($a:expr, $b:expr $(,)*) => {{std::cmp::max($a, $b)}};($a:expr, $($rest:expr),+ $(,)*) => {{std::cmp::max($a, max!($($rest),+))}};}
macro_rules! chmin {($base:expr, $($cmps:expr),+ $(,)*) => {{let cmp_min = min!($($cmps),+);if $base > cmp_min {$base = cmp_min;true} else {false}}};}
macro_rules! chmax {($base:expr, $($cmps:expr),+ $(,)*) => {{let cmp_max = max!($($cmps),+);if $base < cmp_max {$base = cmp_max;true} else {false}}};}
macro_rules! mulvec {($x:expr; $s:expr) => {vec![$x; $s]};($x:expr; $s0:expr; $( $s:expr );+) => {mulvec![vec![$x; $s0]; $( $s );+ ]};}
macro_rules! outputln {($var:expr)=>{println!("{}",$var)};($var:expr,$($vars:expr),+)=>{print!("{} ",$var);outputln!($($vars),+);};}
macro_rules! debug {($($a:expr),* $(,)*) => {eprintln!(concat!($("| ",stringify!($a), "={:?} "),*, "|"),$(&$a),*);};}


fn solve() {
    input! {
        n:usize,
		m:usize,
		w:usize,
		mut A:[usize;n],
		B:[usize;m],
		C:[usize;m],
    }
	A.sort();
	let mut As = vec![0];
	let mut s = 0;
	for &a in A.iter().rev() {
		s += a;
		As.push(s);
	}
	let mut ans = 0;
	for bit in 0..(1<<m) {
		let mut b = 0;
		let mut c = 0;
		for i in 0..m {
			if (bit>>i)&1 == 1 {
				b += B[i];
				c += C[i];
			}
		}
		if b <= w {
			chmax!(ans, c + As[(w-b).min(n)]);
		}
	}
	outputln!(ans);


}

fn main() {
    std::thread::Builder::new()
        .stack_size(128 * 1024 * 1024)
        .spawn(|| solve()).unwrap()
        .join().unwrap();
}
0