結果

問題 No.5 数字のブロック
ユーザー Navier_BoltzmannNavier_Boltzmann
提出日時 2022-11-28 07:27:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 77 ms / 5,000 ms
コード長 423 bytes
コンパイル時間 172 ms
コンパイル使用メモリ 82,468 KB
実行使用メモリ 65,352 KB
最終ジャッジ日時 2024-04-15 09:46:22
合計ジャッジ時間 3,425 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
56,664 KB
testcase_01 AC 57 ms
56,280 KB
testcase_02 AC 53 ms
55,692 KB
testcase_03 AC 77 ms
63,684 KB
testcase_04 AC 63 ms
62,396 KB
testcase_05 AC 64 ms
64,056 KB
testcase_06 AC 60 ms
64,116 KB
testcase_07 AC 60 ms
63,200 KB
testcase_08 AC 59 ms
63,924 KB
testcase_09 AC 61 ms
62,972 KB
testcase_10 AC 60 ms
64,232 KB
testcase_11 AC 60 ms
63,336 KB
testcase_12 AC 63 ms
64,284 KB
testcase_13 AC 64 ms
64,876 KB
testcase_14 AC 56 ms
55,300 KB
testcase_15 AC 54 ms
55,768 KB
testcase_16 AC 60 ms
64,704 KB
testcase_17 AC 65 ms
65,352 KB
testcase_18 AC 63 ms
64,296 KB
testcase_19 AC 58 ms
64,448 KB
testcase_20 AC 53 ms
55,984 KB
testcase_21 AC 55 ms
55,944 KB
testcase_22 AC 56 ms
56,080 KB
testcase_23 AC 56 ms
56,720 KB
testcase_24 AC 57 ms
56,184 KB
testcase_25 AC 54 ms
56,944 KB
testcase_26 AC 56 ms
56,216 KB
testcase_27 AC 55 ms
55,296 KB
testcase_28 AC 56 ms
56,224 KB
testcase_29 AC 64 ms
64,380 KB
testcase_30 AC 61 ms
63,020 KB
testcase_31 AC 56 ms
56,548 KB
testcase_32 AC 57 ms
57,212 KB
testcase_33 AC 56 ms
57,212 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