結果

問題 No.5 数字のブロック
ユーザー K HK H
提出日時 2020-08-23 12:20:59
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 22 ms / 5,000 ms
コード長 191 bytes
コンパイル時間 125 ms
コンパイル使用メモリ 10,664 KB
実行使用メモリ 9,400 KB
最終ジャッジ日時 2023-08-05 21:06:08
合計ジャッジ時間 2,657 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,980 KB
testcase_01 AC 17 ms
8,008 KB
testcase_02 AC 17 ms
8,064 KB
testcase_03 AC 21 ms
8,812 KB
testcase_04 AC 20 ms
8,672 KB
testcase_05 AC 21 ms
9,064 KB
testcase_06 AC 20 ms
8,776 KB
testcase_07 AC 19 ms
8,728 KB
testcase_08 AC 20 ms
8,736 KB
testcase_09 AC 18 ms
7,960 KB
testcase_10 AC 22 ms
9,100 KB
testcase_11 AC 19 ms
8,592 KB
testcase_12 AC 20 ms
8,820 KB
testcase_13 AC 20 ms
9,128 KB
testcase_14 AC 17 ms
8,028 KB
testcase_15 AC 17 ms
8,056 KB
testcase_16 AC 20 ms
9,056 KB
testcase_17 AC 19 ms
9,300 KB
testcase_18 AC 20 ms
9,144 KB
testcase_19 AC 20 ms
9,400 KB
testcase_20 AC 16 ms
7,944 KB
testcase_21 AC 17 ms
7,916 KB
testcase_22 AC 16 ms
7,968 KB
testcase_23 AC 17 ms
7,872 KB
testcase_24 AC 17 ms
7,964 KB
testcase_25 AC 17 ms
8,036 KB
testcase_26 AC 17 ms
8,032 KB
testcase_27 AC 17 ms
7,884 KB
testcase_28 AC 18 ms
7,960 KB
testcase_29 AC 19 ms
8,488 KB
testcase_30 AC 18 ms
8,388 KB
testcase_31 AC 17 ms
8,028 KB
testcase_32 AC 17 ms
7,856 KB
testcase_33 AC 17 ms
7,868 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq
L = int(input())
input()
e = list(map(int, input().split()))
heapq.heapify(e)
count = 0
while e:
    L -= heapq.heappop(e)
    if L < 0:
        break
    count += 1
print(count)
0