結果

問題 No.2424 Josouzai
ユーザー ynpppynppp
提出日時 2023-09-04 09:09:49
言語 Rust
(1.77.0)
結果
AC  
実行時間 30 ms / 2,000 ms
コード長 688 bytes
コンパイル時間 6,953 ms
コンパイル使用メモリ 139,896 KB
実行使用メモリ 5,780 KB
最終ジャッジ日時 2023-09-04 09:09:59
合計ジャッジ時間 3,174 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 9 ms
4,388 KB
testcase_05 AC 29 ms
5,760 KB
testcase_06 AC 29 ms
5,508 KB
testcase_07 AC 28 ms
5,512 KB
testcase_08 AC 30 ms
5,780 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 4 ms
4,380 KB
testcase_11 AC 11 ms
4,720 KB
testcase_12 AC 8 ms
4,376 KB
testcase_13 AC 9 ms
4,384 KB
testcase_14 AC 16 ms
4,380 KB
testcase_15 AC 3 ms
4,376 KB
testcase_16 AC 25 ms
5,184 KB
testcase_17 AC 7 ms
4,380 KB
testcase_18 AC 9 ms
4,380 KB
testcase_19 AC 14 ms
4,376 KB
testcase_20 AC 26 ms
5,472 KB
testcase_21 AC 19 ms
4,468 KB
testcase_22 AC 9 ms
4,380 KB
testcase_23 AC 11 ms
4,376 KB
testcase_24 AC 5 ms
4,380 KB
testcase_25 AC 29 ms
5,496 KB
testcase_26 AC 19 ms
4,680 KB
testcase_27 AC 29 ms
5,668 KB
testcase_28 AC 25 ms
5,184 KB
testcase_29 AC 22 ms
4,688 KB
testcase_30 AC 6 ms
4,376 KB
testcase_31 AC 13 ms
4,376 KB
testcase_32 AC 28 ms
5,672 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