結果

問題 No.5 数字のブロック
ユーザー Navier_BoltzmannNavier_Boltzmann
提出日時 2022-11-28 07:27:56
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 118 ms / 5,000 ms
コード長 423 bytes
コンパイル時間 361 ms
コンパイル使用メモリ 87,404 KB
実行使用メモリ 77,640 KB
最終ジャッジ日時 2023-07-27 23:24:06
合計ジャッジ時間 5,609 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 111 ms
72,976 KB
testcase_01 AC 110 ms
73,172 KB
testcase_02 AC 115 ms
73,276 KB
testcase_03 AC 116 ms
77,524 KB
testcase_04 AC 113 ms
77,520 KB
testcase_05 AC 113 ms
77,572 KB
testcase_06 AC 114 ms
77,608 KB
testcase_07 AC 115 ms
77,360 KB
testcase_08 AC 113 ms
77,516 KB
testcase_09 AC 112 ms
77,640 KB
testcase_10 AC 117 ms
77,500 KB
testcase_11 AC 116 ms
77,596 KB
testcase_12 AC 114 ms
77,428 KB
testcase_13 AC 116 ms
77,492 KB
testcase_14 AC 112 ms
73,012 KB
testcase_15 AC 112 ms
73,172 KB
testcase_16 AC 118 ms
77,568 KB
testcase_17 AC 115 ms
77,368 KB
testcase_18 AC 118 ms
77,536 KB
testcase_19 AC 114 ms
77,492 KB
testcase_20 AC 109 ms
73,120 KB
testcase_21 AC 113 ms
73,096 KB
testcase_22 AC 111 ms
72,884 KB
testcase_23 AC 109 ms
73,192 KB
testcase_24 AC 108 ms
73,004 KB
testcase_25 AC 106 ms
72,928 KB
testcase_26 AC 109 ms
73,088 KB
testcase_27 AC 110 ms
72,972 KB
testcase_28 AC 108 ms
73,104 KB
testcase_29 AC 112 ms
77,400 KB
testcase_30 AC 113 ms
77,544 KB
testcase_31 AC 109 ms
72,888 KB
testcase_32 AC 111 ms
73,404 KB
testcase_33 AC 116 ms
73,052 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# import pypyjit
# pypyjit.set_param('max_unroll_recursion=-1')
from collections import *
from functools import *
from itertools import *
from heapq import *
import sys,math
input = sys.stdin.readline

L = int(input())
N = int(input())
W = list(map(int,input().split()))
W.sort()
res = 0
cnt = 0
W = deque(W)
while W:
    w = W.popleft()
    if res+w<=L:
        res += w
        cnt += 1
    else:
        break
print(cnt)
0