結果

問題 No.2693 Sword
ユーザー titiatitia
提出日時 2024-03-28 00:07:13
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 610 ms / 2,000 ms
コード長 348 bytes
コンパイル時間 120 ms
コンパイル使用メモリ 11,776 KB
実行使用メモリ 9,856 KB
最終ジャッジ日時 2024-03-28 00:07:17
合計ジャッジ時間 3,852 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
9,728 KB
testcase_01 AC 30 ms
9,728 KB
testcase_02 AC 29 ms
9,728 KB
testcase_03 AC 29 ms
9,728 KB
testcase_04 AC 29 ms
9,728 KB
testcase_05 AC 29 ms
9,728 KB
testcase_06 AC 29 ms
9,728 KB
testcase_07 AC 29 ms
9,728 KB
testcase_08 AC 29 ms
9,728 KB
testcase_09 AC 217 ms
9,856 KB
testcase_10 AC 40 ms
9,728 KB
testcase_11 AC 117 ms
9,856 KB
testcase_12 AC 28 ms
9,728 KB
testcase_13 AC 44 ms
9,856 KB
testcase_14 AC 34 ms
9,728 KB
testcase_15 AC 128 ms
9,856 KB
testcase_16 AC 126 ms
9,856 KB
testcase_17 AC 190 ms
9,856 KB
testcase_18 AC 61 ms
9,856 KB
testcase_19 AC 132 ms
9,856 KB
testcase_20 AC 38 ms
9,856 KB
testcase_21 AC 45 ms
9,856 KB
testcase_22 AC 145 ms
9,856 KB
testcase_23 AC 43 ms
9,728 KB
testcase_24 AC 29 ms
9,728 KB
testcase_25 AC 28 ms
9,728 KB
testcase_26 AC 29 ms
9,728 KB
testcase_27 AC 29 ms
9,728 KB
testcase_28 AC 29 ms
9,728 KB
testcase_29 AC 29 ms
9,728 KB
testcase_30 AC 29 ms
9,728 KB
testcase_31 AC 29 ms
9,728 KB
testcase_32 AC 610 ms
9,856 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N,P,K=map(int,input().split())

DP=[0]*(K+1)
DP[0]=P


for i in range(N):
    t,b=map(int,input().split())

    for j in range(K-1,-1,-1):
        if t==1:
            DP[j+1]=max(DP[j+1],DP[j]+b)
        else:
            DP[j+1]=max(DP[j+1],DP[j]*2)

if DP[-1]>10**18:
    print(-1)
else:
    print(DP[-1])
0