結果

問題 No.2424 Josouzai
ユーザー ynpppynppp
提出日時 2023-09-04 09:07:50
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 691 bytes
コンパイル時間 6,212 ms
コンパイル使用メモリ 148,544 KB
実行使用メモリ 5,808 KB
最終ジャッジ日時 2023-09-04 09:08:02
合計ジャッジ時間 11,245 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 WA -
testcase_04 AC 9 ms
4,380 KB
testcase_05 AC 30 ms
5,732 KB
testcase_06 AC 28 ms
5,508 KB
testcase_07 AC 29 ms
5,536 KB
testcase_08 AC 30 ms
5,764 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 4 ms
4,380 KB
testcase_11 AC 11 ms
4,720 KB
testcase_12 AC 9 ms
4,380 KB
testcase_13 AC 9 ms
4,376 KB
testcase_14 AC 16 ms
4,376 KB
testcase_15 AC 3 ms
4,380 KB
testcase_16 AC 27 ms
5,276 KB
testcase_17 AC 7 ms
4,380 KB
testcase_18 AC 9 ms
4,376 KB
testcase_19 AC 15 ms
4,376 KB
testcase_20 AC 27 ms
5,492 KB
testcase_21 AC 20 ms
4,456 KB
testcase_22 AC 10 ms
4,376 KB
testcase_23 AC 11 ms
4,376 KB
testcase_24 AC 5 ms
4,376 KB
testcase_25 AC 28 ms
5,476 KB
testcase_26 AC 20 ms
4,672 KB
testcase_27 AC 30 ms
5,808 KB
testcase_28 AC 25 ms
5,152 KB
testcase_29 AC 22 ms
4,696 KB
testcase_30 AC 6 ms
4,376 KB
testcase_31 AC 14 ms
4,380 KB
testcase_32 AC 29 ms
5,776 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#![allow(dead_code, unused_variables)]
use std::io::{stdin, BufRead};


fn main() {
    let v = veci32_from_line();
    let n = v[0];
    let k = v[1];
    let mut a = veci32_from_line();
    a.sort();
    let mut ground = 0;
    let mut rest = k;
    for i in a.iter() {
        if i >= &rest {
            break;
        }
        rest -= i;
        ground += 1;
    }
    println!("{} {}", ground, rest);
}

fn get_line() -> String {
    let mut buf = String::new();
    stdin().lock().read_line(&mut buf).unwrap();
    buf.trim_end().to_string()
}


fn veci32_from_line() -> Vec<i32> {
    get_line()
        .split_whitespace()
        .map(|s| s.parse().unwrap())
        .collect()
}
0