結果

問題 No.914 Omiyage
ユーザー komkompikomkompi
提出日時 2019-10-25 22:18:19
言語 PyPy3
(7.3.13)
結果
TLE  
実行時間 -
コード長 465 bytes
コンパイル時間 1,137 ms
コンパイル使用メモリ 86,752 KB
実行使用メモリ 88,760 KB
最終ジャッジ日時 2023-10-11 05:00:25
合計ジャッジ時間 7,729 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
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 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

def saiki(i,money,ans):
    if i==N:
        return money
    temp=l[i]
    t=0
    for item in temp:
        if money-item>=0:
            ans=min(saiki(i+1,money-item,ans),ans)
        else:
            return ans
        t+=1
    
    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