結果

問題 No.5 数字のブロック
ユーザー もりを
提出日時 2018-09-04 13:07:27
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 280 bytes
コンパイル時間 170 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 16,640 KB
最終ジャッジ日時 2024-10-13 07:44:50
合計ジャッジ時間 14,375 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 5 TLE * 1 -- * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools
l = int(input())
n = int(input())
w = sorted(list(map(int,input().split())))
w_acc = [0] + list(itertools.accumulate(w))
for res in range(n,0,-1):
    for i in range(n-res+1):
        if w_acc[i+res]-w_acc[i]<=l:
            print(res)
            exit()
print(0)
0