結果

問題 No.2693 Sword
ユーザー 👑 timitimi
提出日時 2024-03-02 13:33:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 125 ms / 2,000 ms
コード長 581 bytes
コンパイル時間 307 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 76,352 KB
最終ジャッジ日時 2024-03-02 13:33:10
合計ジャッジ時間 3,952 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
55,628 KB
testcase_01 AC 40 ms
55,628 KB
testcase_02 AC 40 ms
55,624 KB
testcase_03 AC 39 ms
55,620 KB
testcase_04 AC 40 ms
55,628 KB
testcase_05 AC 40 ms
55,628 KB
testcase_06 AC 41 ms
55,628 KB
testcase_07 AC 40 ms
55,628 KB
testcase_08 AC 39 ms
55,628 KB
testcase_09 AC 57 ms
66,644 KB
testcase_10 AC 48 ms
61,724 KB
testcase_11 AC 52 ms
66,644 KB
testcase_12 AC 40 ms
55,628 KB
testcase_13 AC 50 ms
64,572 KB
testcase_14 AC 47 ms
61,720 KB
testcase_15 AC 80 ms
76,316 KB
testcase_16 AC 62 ms
70,804 KB
testcase_17 AC 90 ms
76,352 KB
testcase_18 AC 64 ms
73,000 KB
testcase_19 AC 62 ms
70,820 KB
testcase_20 AC 53 ms
64,592 KB
testcase_21 AC 53 ms
66,660 KB
testcase_22 AC 62 ms
70,812 KB
testcase_23 AC 55 ms
66,656 KB
testcase_24 AC 40 ms
55,628 KB
testcase_25 AC 40 ms
55,628 KB
testcase_26 AC 41 ms
55,628 KB
testcase_27 AC 41 ms
55,628 KB
testcase_28 AC 40 ms
55,620 KB
testcase_29 AC 41 ms
55,628 KB
testcase_30 AC 41 ms
55,628 KB
testcase_31 AC 41 ms
55,620 KB
testcase_32 AC 125 ms
76,308 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque  
mod=998244353
from sys import stdin, setrecursionlimit
input = stdin.readline
readline = stdin.readline
import math
N,M,K=map(int, stdin.readline().split())
dp=[-1]*(K+1) 
dp[0]=M;f=0
for _ in range(N):
  t,b=map(int, stdin.readline().split())
  ndp=[-1]*(K+1)
  # if f==1:
  #   continue
  for i in range(K+1):
    ndp[i]=max(ndp[i],dp[i])
    if i!=0:
      if t==1:
        ndp[i]=max(ndp[i],dp[i-1]+b)
      else:
        ndp[i]=max(ndp[i],dp[i-1]*2)
  dp=ndp
  # if dp[-1]>10**18:
  #   f=1
if dp[-1]>10**18:
  print(-1)
else:
  print(dp[-1])  
0