結果

問題 No.2693 Sword
ユーザー とりゐとりゐ
提出日時 2024-03-22 21:30:44
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 73 ms / 2,000 ms
コード長 354 bytes
コンパイル時間 202 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 73,140 KB
最終ジャッジ日時 2024-03-22 21:30:47
合計ジャッジ時間 2,806 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,332 KB
testcase_01 AC 38 ms
53,332 KB
testcase_02 AC 37 ms
53,332 KB
testcase_03 AC 38 ms
53,332 KB
testcase_04 AC 37 ms
53,332 KB
testcase_05 AC 37 ms
53,332 KB
testcase_06 AC 37 ms
53,332 KB
testcase_07 AC 38 ms
53,332 KB
testcase_08 AC 37 ms
53,332 KB
testcase_09 AC 64 ms
71,016 KB
testcase_10 AC 49 ms
61,976 KB
testcase_11 AC 60 ms
68,964 KB
testcase_12 AC 38 ms
53,332 KB
testcase_13 AC 59 ms
66,888 KB
testcase_14 AC 37 ms
53,332 KB
testcase_15 AC 51 ms
64,032 KB
testcase_16 AC 59 ms
66,876 KB
testcase_17 AC 44 ms
59,772 KB
testcase_18 AC 44 ms
59,896 KB
testcase_19 AC 72 ms
73,140 KB
testcase_20 AC 54 ms
64,816 KB
testcase_21 AC 56 ms
66,912 KB
testcase_22 AC 73 ms
73,136 KB
testcase_23 AC 63 ms
66,892 KB
testcase_24 AC 38 ms
53,332 KB
testcase_25 AC 38 ms
53,332 KB
testcase_26 AC 38 ms
53,332 KB
testcase_27 AC 38 ms
53,332 KB
testcase_28 AC 38 ms
53,332 KB
testcase_29 AC 38 ms
53,332 KB
testcase_30 AC 37 ms
53,332 KB
testcase_31 AC 37 ms
53,332 KB
testcase_32 AC 38 ms
53,332 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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())
  if t==1:
    for j in range(K-1,-1,-1):
      if dp[j]!=0:
        dp[j+1]=max(dp[j+1],dp[j]+b)
  else:
    for j in range(K-1,-1,-1):
      if dp[j]!=0:
        dp[j+1]=max(dp[j+1],dp[j]*2)
  if max(dp)>10**18:
    print(-1)
    exit()

print(dp[K])
0