結果

問題 No.2424 Josouzai
ユーザー ゆうPゆうP
提出日時 2024-05-22 23:59:21
言語 Go
(1.22.1)
結果
TLE  
実行時間 -
コード長 338 bytes
コンパイル時間 11,227 ms
コンパイル使用メモリ 221,000 KB
実行使用メモリ 8,076 KB
最終ジャッジ日時 2024-05-23 00:00:10
合計ジャッジ時間 44,369 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 1 ms
6,816 KB
testcase_02 AC 1 ms
6,812 KB
testcase_03 AC 1 ms
6,820 KB
testcase_04 AC 522 ms
7,840 KB
testcase_05 AC 1,950 ms
8,068 KB
testcase_06 AC 1,745 ms
8,072 KB
testcase_07 AC 1,798 ms
8,072 KB
testcase_08 TLE -
testcase_09 AC 2 ms
6,944 KB
testcase_10 AC 471 ms
7,840 KB
testcase_11 AC 1,395 ms
8,076 KB
testcase_12 AC 1,018 ms
7,952 KB
testcase_13 AC 601 ms
7,836 KB
testcase_14 AC 1,047 ms
7,956 KB
testcase_15 AC 148 ms
6,940 KB
testcase_16 AC 1,703 ms
8,072 KB
testcase_17 AC 450 ms
6,940 KB
testcase_18 AC 513 ms
7,836 KB
testcase_19 AC 906 ms
7,828 KB
testcase_20 AC 1,719 ms
8,072 KB
testcase_21 AC 1,312 ms
7,952 KB
testcase_22 AC 600 ms
7,840 KB
testcase_23 AC 703 ms
7,832 KB
testcase_24 AC 310 ms
6,940 KB
testcase_25 AC 1,814 ms
8,076 KB
testcase_26 AC 1,306 ms
7,952 KB
testcase_27 AC 1,870 ms
8,076 KB
testcase_28 AC 1,635 ms
7,948 KB
testcase_29 AC 1,452 ms
7,952 KB
testcase_30 AC 326 ms
6,944 KB
testcase_31 AC 854 ms
7,828 KB
testcase_32 AC 1,860 ms
8,076 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// No.2424 Josouzai
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, k int
	fmt.Scan(&n, &k)

	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
	}
	sort.Ints(a)

	var ans1, ans2 = 0, k
	for j := 0; j < n; j++ {
		if ans2-a[j] < 0 {
			break
		}
		ans2 -= a[j]
		ans1++
	}
	fmt.Printf("%d %d\n", ans1, ans2)
}
0