結果

問題 No.2693 Sword
ユーザー mutualnsmutualns
提出日時 2024-03-23 05:46:44
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 470 bytes
コンパイル時間 524 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 70,832 KB
最終ジャッジ日時 2024-03-23 05:46:48
合計ジャッジ時間 3,346 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,332 KB
testcase_01 AC 38 ms
53,332 KB
testcase_02 AC 38 ms
53,332 KB
testcase_03 WA -
testcase_04 AC 39 ms
53,332 KB
testcase_05 AC 39 ms
53,332 KB
testcase_06 AC 40 ms
53,332 KB
testcase_07 AC 39 ms
53,332 KB
testcase_08 AC 40 ms
53,332 KB
testcase_09 AC 62 ms
66,652 KB
testcase_10 AC 51 ms
61,716 KB
testcase_11 AC 59 ms
66,652 KB
testcase_12 AC 39 ms
53,332 KB
testcase_13 AC 59 ms
64,548 KB
testcase_14 AC 38 ms
53,332 KB
testcase_15 AC 51 ms
61,716 KB
testcase_16 AC 64 ms
66,640 KB
testcase_17 AC 41 ms
59,388 KB
testcase_18 AC 43 ms
59,516 KB
testcase_19 AC 75 ms
70,816 KB
testcase_20 AC 55 ms
64,572 KB
testcase_21 AC 60 ms
66,652 KB
testcase_22 AC 77 ms
70,832 KB
testcase_23 AC 59 ms
66,676 KB
testcase_24 WA -
testcase_25 AC 38 ms
53,332 KB
testcase_26 AC 39 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 39 ms
53,332 KB
testcase_31 AC 39 ms
53,332 KB
testcase_32 AC 42 ms
57,300 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,p,k=map(int,input().split())
dp=[-1]*(k+1)
dp[0]=p
for i in range(n):
  a,b=map(int,input().split())
  if a==1:
    for j in range(1,k+1):
      if dp[-j-1]==-1:
        continue
      dp[-j]=max(dp[-j],dp[-j-1]+b)
      if dp[-j+1]>=10**18:
        print(-1)
        exit()
  else:
    for j in range(1,k+1):
      if dp[-j-1]==-1:
        continue
      dp[-j]=max(dp[-j],dp[-j-1]*2)
      if dp[-j+1]>=10**18:
        print(-1)
        exit()
        
print(dp[-1])
0