結果

問題 No.1736 Princess vs. Dragoness
ユーザー seinyanseinyan
提出日時 2021-11-13 09:28:53
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 1,067 bytes
コンパイル時間 16,988 ms
コンパイル使用メモリ 377,856 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-05 04:29:01
合計ジャッジ時間 15,371 ms
ジャッジサーバーID
(参考情報)
judge5 / 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 1 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 1 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 WA -
testcase_14 AC 1 ms
5,376 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 1 ms
5,376 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 0 ms
5,376 KB
testcase_21 AC 1 ms
5,376 KB
testcase_22 AC 1 ms
5,376 KB
testcase_23 AC 1 ms
5,376 KB
testcase_24 AC 1 ms
5,376 KB
testcase_25 AC 1 ms
5,376 KB
testcase_26 AC 1 ms
5,376 KB
testcase_27 AC 1 ms
5,376 KB
testcase_28 AC 1 ms
5,376 KB
testcase_29 AC 1 ms
5,376 KB
testcase_30 AC 1 ms
5,376 KB
testcase_31 AC 0 ms
5,376 KB
testcase_32 AC 1 ms
5,376 KB
testcase_33 AC 1 ms
5,376 KB
testcase_34 AC 1 ms
5,376 KB
testcase_35 AC 0 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

fn main() {
    let v1: Vec<i64> = input_line();
    let (n, mut a, b, x, y) = (v1[0] as usize, v1[1], v1[2], v1[3], v1[4]);
    let mut hv: Vec<i64> = input_line();

    hv.sort();

    let mut idx_defeat = 0_usize;

    let mut b_total = b * y;

    while b > 0 && idx_defeat < n {
        if b_total >= hv[idx_defeat] {
            b_total -= hv[idx_defeat];
            hv[idx_defeat] = 0;
            idx_defeat += 1;
        } else {
            hv[idx_defeat] -= b_total;
            break;
        }
    }
    while a > 0 && idx_defeat < n {
        while hv[idx_defeat] > 0 && a > 0 {
            hv[idx_defeat] -= x;
            a -= 1;
            if hv[idx_defeat] < 0 {
                idx_defeat += 1;
                break;
            }
        }
    }

    println!("{}", if idx_defeat == n { "Yes" } else { "No" });
}

fn input_line<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
0