結果

問題 No.5 数字のブロック
ユーザー zeroalpha0zeroalpha0
提出日時 2017-03-21 09:14:11
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 20 ms / 5,000 ms
コード長 192 bytes
コンパイル時間 691 ms
コンパイル使用メモリ 10,684 KB
実行使用メモリ 9,444 KB
最終ジャッジ日時 2023-08-11 17:12:09
合計ジャッジ時間 1,992 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,004 KB
testcase_01 AC 17 ms
7,952 KB
testcase_02 AC 17 ms
7,968 KB
testcase_03 AC 19 ms
8,820 KB
testcase_04 AC 17 ms
8,532 KB
testcase_05 AC 19 ms
9,004 KB
testcase_06 AC 18 ms
8,720 KB
testcase_07 AC 18 ms
8,584 KB
testcase_08 AC 18 ms
8,748 KB
testcase_09 AC 18 ms
8,388 KB
testcase_10 AC 20 ms
9,116 KB
testcase_11 AC 18 ms
8,504 KB
testcase_12 AC 19 ms
8,956 KB
testcase_13 AC 19 ms
9,152 KB
testcase_14 AC 16 ms
7,872 KB
testcase_15 AC 16 ms
7,916 KB
testcase_16 AC 19 ms
9,052 KB
testcase_17 AC 20 ms
9,148 KB
testcase_18 AC 20 ms
9,120 KB
testcase_19 AC 20 ms
9,444 KB
testcase_20 AC 16 ms
7,972 KB
testcase_21 AC 16 ms
8,004 KB
testcase_22 AC 16 ms
8,108 KB
testcase_23 AC 17 ms
7,876 KB
testcase_24 AC 16 ms
7,952 KB
testcase_25 AC 17 ms
7,960 KB
testcase_26 AC 17 ms
8,060 KB
testcase_27 AC 16 ms
8,076 KB
testcase_28 AC 16 ms
7,912 KB
testcase_29 AC 18 ms
8,568 KB
testcase_30 AC 17 ms
8,400 KB
testcase_31 AC 16 ms
7,868 KB
testcase_32 AC 17 ms
8,100 KB
testcase_33 AC 16 ms
7,896 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq
L = int(input())
N = int(input())

a = [int(i) for i in input().split()]
heapq.heapify(a)
count = 0
while a:
	L -= heapq.heappop(a)
	if L<0:
		break
	count += 1

print (count)	

	
0