結果

問題 No.2424 Josouzai
ユーザー ynpppynppp
提出日時 2023-09-04 09:09:49
言語 Rust
(1.77.0)
結果
AC  
実行時間 34 ms / 2,000 ms
コード長 688 bytes
コンパイル時間 13,483 ms
コンパイル使用メモリ 402,156 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-22 08:15:51
合計ジャッジ時間 15,820 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 1 ms
6,812 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 AC 1 ms
6,944 KB
testcase_04 AC 10 ms
6,940 KB
testcase_05 AC 34 ms
6,944 KB
testcase_06 AC 33 ms
6,944 KB
testcase_07 AC 33 ms
6,940 KB
testcase_08 AC 34 ms
6,944 KB
testcase_09 AC 1 ms
6,944 KB
testcase_10 AC 5 ms
6,944 KB
testcase_11 AC 12 ms
6,940 KB
testcase_12 AC 9 ms
6,940 KB
testcase_13 AC 10 ms
6,944 KB
testcase_14 AC 19 ms
6,940 KB
testcase_15 AC 3 ms
6,940 KB
testcase_16 AC 30 ms
6,944 KB
testcase_17 AC 8 ms
6,944 KB
testcase_18 AC 9 ms
6,944 KB
testcase_19 AC 16 ms
6,944 KB
testcase_20 AC 31 ms
6,940 KB
testcase_21 AC 23 ms
6,940 KB
testcase_22 AC 10 ms
6,944 KB
testcase_23 AC 13 ms
6,944 KB
testcase_24 AC 6 ms
6,940 KB
testcase_25 AC 32 ms
6,944 KB
testcase_26 AC 23 ms
6,944 KB
testcase_27 AC 34 ms
6,944 KB
testcase_28 AC 29 ms
6,944 KB
testcase_29 AC 25 ms
6,944 KB
testcase_30 AC 7 ms
6,944 KB
testcase_31 AC 15 ms
6,940 KB
testcase_32 AC 32 ms
6,940 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