結果

問題 No.1736 Princess vs. Dragoness
ユーザー seinyanseinyan
提出日時 2021-11-12 22:36:46
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 1,450 bytes
コンパイル時間 14,653 ms
コンパイル使用メモリ 380,008 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-04 10:01:13
合計ジャッジ時間 12,116 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 WA -
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 0 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 1 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 WA -
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 1 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

    let mut ind = 0_usize;
    'outer: loop {
        if hv[ind] <= x && a > 0 {
            hv[ind] -= x;
            a -= 1;
            ind += 1;
            if ind == n {
                break 'outer;
            }
        } else if b > 0 {
            let mut p = y;
            loop {
                if hv[ind] >= p {
                    hv[ind] -= p;
                    break;
                } else {
                    p -= hv[ind];
                    hv[ind] = 0;
                    ind += 1;
                    if ind == n {
                        break 'outer;
                    }
                }
            }
            b -= 1;
        } else if a > 0 {
            hv[ind] -= x;
            a -= 1;
            if hv[ind] <= 0 {
                hv[ind] = 0;
                ind += 1;
                if ind == n {
                    break 'outer;
                }
            }
        }

        if a == 0 && b == 0 {
            break;
        }
    }
    println!("{}", if hv[n - 1] <= 0 { "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