結果

問題 No.2424 Josouzai
ユーザー bluemeganebluemegane
提出日時 2023-08-18 22:17:19
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 144 ms / 2,000 ms
コード長 650 bytes
コンパイル時間 1,117 ms
コンパイル使用メモリ 103,808 KB
実行使用メモリ 38,400 KB
最終ジャッジ日時 2024-05-06 04:27:42
合計ジャッジ時間 5,224 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 23 ms
17,792 KB
testcase_01 AC 22 ms
17,920 KB
testcase_02 AC 23 ms
17,920 KB
testcase_03 AC 21 ms
17,792 KB
testcase_04 AC 58 ms
23,424 KB
testcase_05 AC 144 ms
38,400 KB
testcase_06 AC 141 ms
37,504 KB
testcase_07 AC 140 ms
37,760 KB
testcase_08 AC 143 ms
38,272 KB
testcase_09 AC 22 ms
17,792 KB
testcase_10 AC 50 ms
23,508 KB
testcase_11 AC 106 ms
35,968 KB
testcase_12 AC 86 ms
33,664 KB
testcase_13 AC 59 ms
23,680 KB
testcase_14 AC 91 ms
33,152 KB
testcase_15 AC 37 ms
19,968 KB
testcase_16 AC 129 ms
36,992 KB
testcase_17 AC 52 ms
22,272 KB
testcase_18 AC 54 ms
23,040 KB
testcase_19 AC 75 ms
27,136 KB
testcase_20 AC 125 ms
37,248 KB
testcase_21 AC 102 ms
34,432 KB
testcase_22 AC 57 ms
23,680 KB
testcase_23 AC 64 ms
25,600 KB
testcase_24 AC 42 ms
20,736 KB
testcase_25 AC 131 ms
37,376 KB
testcase_26 AC 108 ms
34,304 KB
testcase_27 AC 144 ms
38,144 KB
testcase_28 AC 118 ms
36,224 KB
testcase_29 AC 112 ms
35,200 KB
testcase_30 AC 49 ms
21,564 KB
testcase_31 AC 76 ms
26,496 KB
testcase_32 AC 133 ms
37,888 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

public class Hello
{
    static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var k = long.Parse(line[1]);
        line = Console.ReadLine().Trim().Split(' ');
        var a = Array.ConvertAll(line, long.Parse);
        getAns(n, k, a);
    }
    static void getAns(int n, long k, long[] a)
    {
        Array.Sort(a);
        var s = 0L;
        for (int i = 0; i < n; i++)
        {
            if (s + a[i] > k) { Console.WriteLine("{0} {1}", i, k - s); return; }
            s += a[i];
        }
        Console.WriteLine("{0} {1}", n, k - s);
    }
}
0