結果

問題 No.2424 Josouzai
ユーザー 👑 kakel-sankakel-san
提出日時 2023-08-18 21:17:05
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 171 ms / 2,000 ms
コード長 818 bytes
コンパイル時間 2,383 ms
コンパイル使用メモリ 107,264 KB
実行使用メモリ 38,784 KB
最終ジャッジ日時 2024-05-06 03:00:15
合計ジャッジ時間 7,261 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
18,816 KB
testcase_01 AC 26 ms
18,944 KB
testcase_02 AC 26 ms
18,816 KB
testcase_03 AC 25 ms
18,560 KB
testcase_04 AC 66 ms
24,320 KB
testcase_05 AC 171 ms
38,784 KB
testcase_06 AC 159 ms
38,144 KB
testcase_07 AC 162 ms
38,016 KB
testcase_08 AC 163 ms
38,528 KB
testcase_09 AC 27 ms
19,072 KB
testcase_10 AC 67 ms
24,980 KB
testcase_11 AC 123 ms
36,224 KB
testcase_12 AC 100 ms
34,176 KB
testcase_13 AC 67 ms
24,576 KB
testcase_14 AC 103 ms
33,792 KB
testcase_15 AC 39 ms
21,120 KB
testcase_16 AC 142 ms
37,248 KB
testcase_17 AC 58 ms
23,376 KB
testcase_18 AC 63 ms
23,680 KB
testcase_19 AC 89 ms
28,032 KB
testcase_20 AC 145 ms
37,504 KB
testcase_21 AC 118 ms
35,328 KB
testcase_22 AC 65 ms
24,448 KB
testcase_23 AC 75 ms
26,368 KB
testcase_24 AC 47 ms
21,760 KB
testcase_25 AC 151 ms
37,888 KB
testcase_26 AC 122 ms
35,200 KB
testcase_27 AC 165 ms
38,272 KB
testcase_28 AC 150 ms
36,864 KB
testcase_29 AC 130 ms
35,968 KB
testcase_30 AC 52 ms
22,664 KB
testcase_31 AC 85 ms
27,520 KB
testcase_32 AC 153 ms
38,272 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;
class Program
{
    static int NN => int.Parse(ReadLine());
    static int[] NList => ReadLine().Split().Select(int.Parse).ToArray();
    static int[] LList(long n) => Enumerable.Repeat(0, (int)n).Select(_ => int.Parse(ReadLine())).ToArray();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var c = NList;
        var (n, k) = (c[0], c[1]);
        var a = NList;
        Array.Sort(a);
        var ans = 0;
        var rest = k;
        for (var i = 0; i < n; ++i)
        {
            if (a[i] <= rest)
            {
                rest -= a[i];
                ++ans;
            }
        }
        WriteLine($"{ans} {rest}");
    }
}
0