結果

問題 No.617 Nafmo、買い出しに行く
コンテスト
ユーザー senden_lite
提出日時 2017-12-27 12:13:27
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
WA  
実行時間 -
コード長 413 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 489 ms
コンパイル使用メモリ 20,812 KB
実行使用メモリ 32,944 KB
最終ジャッジ日時 2026-05-28 00:18:44
合計ジャッジ時間 8,407 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 2
other AC * 1 WA * 4 TLE * 2 -- * 13
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

i = input().split()
N = int(i[0])
K = int(i[1])

a =[0]*N

for i in range(N):
    a[i] = int(input())

b = [True] + [False]*K

for i in range(N):
    n = a[i]
    for j in range(len(b)):
        if b[-(j+1)] != False:
            index = len(b)-j-1
    if n + index <= K and b[n+index] == False:
        b[n+index] = True

for i in range(len(b)):
    if b[-(i+1)] != False:
        print(len(b)-i-1)
        break
0