結果

問題 No.617 Nafmo、買い出しに行く
ユーザー senden_litesenden_lite
提出日時 2017-12-27 12:46:25
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 426 bytes
コンパイル時間 104 ms
コンパイル使用メモリ 10,732 KB
実行使用メモリ 30,172 KB
最終ジャッジ日時 2023-08-23 07:11:48
合計ジャッジ時間 7,549 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 455 ms
17,700 KB
testcase_01 AC 18 ms
8,236 KB
testcase_02 AC 687 ms
13,596 KB
testcase_03 AC 1,818 ms
18,584 KB
testcase_04 AC 139 ms
9,760 KB
testcase_05 TLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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
l = len(b)
an = 0

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

print(an)
0