結果

問題 No.914 Omiyage
ユーザー komkompikomkompi
提出日時 2019-10-25 22:33:05
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 523 bytes
コンパイル時間 456 ms
コンパイル使用メモリ 10,976 KB
実行使用メモリ 12,628 KB
最終ジャッジ日時 2023-10-11 05:31:51
合計ジャッジ時間 4,579 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,332 KB
testcase_01 AC 16 ms
8,160 KB
testcase_02 AC 17 ms
7,832 KB
testcase_03 AC 16 ms
8,292 KB
testcase_04 AC 17 ms
8,172 KB
testcase_05 AC 16 ms
7,888 KB
testcase_06 AC 16 ms
7,760 KB
testcase_07 AC 16 ms
7,872 KB
testcase_08 AC 16 ms
8,296 KB
testcase_09 AC 16 ms
7,876 KB
testcase_10 AC 19 ms
7,824 KB
testcase_11 AC 16 ms
7,980 KB
testcase_12 TLE -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8
# Your code here!
N,M,K=map(int,input().split())
l=[]

def saiki(i,money,ans):
    if i==N:
        if money==0:
            print(0)
            exit()
        else:
            return money
    temp=l[i]
    for item in temp[::-1]:
        if money-item>=0:
            ans=min(saiki(i+1,money-item,ans),ans)
        else:
            pass
    
    return ans        

for _ in range(N):
    l.append(list(map(int,input().split())))

a=(saiki(0,K,10**18))
if a==10**18:
    print(-1)
else:
    print(a)


0