結果

問題 No.5 数字のブロック
ユーザー Navier_Boltzmann
提出日時 2022-11-28 07:27:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 48 ms / 5,000 ms
コード長 423 bytes
コンパイル時間 158 ms
コンパイル使用メモリ 81,996 KB
実行使用メモリ 64,640 KB
最終ジャッジ日時 2024-10-05 03:07:34
合計ジャッジ時間 2,761 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

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