結果

問題 No.1015 おつりは要らないです
コンテスト
ユーザー tzyvrn
提出日時 2020-04-03 23:49:48
言語 Rust
(1.93.0 + proconio + num + itertools)
コンパイル:
/usr/bin/rustc_custom
実行:
./target/release/main
結果
WA  
実行時間 -
コード長 1,571 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,013 ms
コンパイル使用メモリ 192,128 KB
実行使用メモリ 6,144 KB
最終ジャッジ日時 2026-03-24 13:51:09
合計ジャッジ時間 2,486 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 21 WA * 12
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

use std::cmp::min;
//{{{
#[allow(unused_macros)]
macro_rules! getl {
    ( $( $t:ty ),* ) => {
        {
            let mut s = String::new();
            std::io::stdin().read_line(&mut s).unwrap();
            let s = s.trim_end();
            let mut ws = s.split_whitespace();
            ($(ws.next().unwrap().parse::<$t>().unwrap()),*)
        }
    };
}

#[allow(unused_macros)]
macro_rules! getl_vec {
    ( $t:ty ) => {
        {
            let mut s = String::new();
            std::io::stdin().read_line(&mut s).unwrap();
            let s = s.trim_end();
            s.split_whitespace().map(|x| x.parse().unwrap()).collect::<Vec<$t>>()
        }
    };
}
//}}}

fn main() {
    let (n, x, y, z) = getl!(usize, i64, i64, i64);
    let mut a = getl_vec!(i64);

    for i in 0..n {
        a[i] += 1;
    }

    let mut z = z;
    for i in 0..n {
        let q = min(a[i] / 10000, z);
        z -= q;
        a[i] -= 10000 * q;
    }
    // a.sort();
    // a.reverse();
    // for i in 0..n {
    //     if z > 0 {
    //     }
    // }

    let mut y = y;
    for i in 0..n {
        let q = min(a[i] / 5000, y);
        y -= q;
        a[i] -= 5000 * q;
    }

    a.sort();
    a.reverse();
    let mut x = x;
    for i in 0..n {
        if a[i] == 0 {
            break;
        }

        if z > 0 {
            z -= 1;
        } else if y > 0 {
            y -= 1;
        } else {
            let q = (a[i] + 1000 - 1) / 1000;
            x -= q;
        }
    }

    if x >= 0 {
        println!("Yes");
    } else {
        println!("No");
    }
}
0