結果

問題 No.2693 Sword
ユーザー 👑 timitimi
提出日時 2024-03-02 13:21:59
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 126 ms / 2,000 ms
コード長 564 bytes
コンパイル時間 427 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 76,436 KB
最終ジャッジ日時 2024-03-02 13:22:03
合計ジャッジ時間 3,729 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
55,596 KB
testcase_01 AC 40 ms
55,604 KB
testcase_02 AC 40 ms
55,604 KB
testcase_03 AC 40 ms
55,604 KB
testcase_04 AC 40 ms
55,596 KB
testcase_05 AC 40 ms
55,604 KB
testcase_06 AC 40 ms
55,596 KB
testcase_07 AC 41 ms
55,596 KB
testcase_08 AC 41 ms
55,596 KB
testcase_09 AC 56 ms
66,644 KB
testcase_10 AC 48 ms
61,720 KB
testcase_11 AC 53 ms
66,644 KB
testcase_12 AC 42 ms
55,604 KB
testcase_13 AC 52 ms
64,568 KB
testcase_14 AC 48 ms
61,720 KB
testcase_15 AC 58 ms
68,084 KB
testcase_16 AC 57 ms
68,740 KB
testcase_17 AC 74 ms
76,352 KB
testcase_18 AC 52 ms
63,948 KB
testcase_19 AC 64 ms
70,820 KB
testcase_20 AC 51 ms
64,592 KB
testcase_21 AC 53 ms
66,660 KB
testcase_22 AC 63 ms
70,812 KB
testcase_23 AC 56 ms
66,656 KB
testcase_24 AC 41 ms
55,604 KB
testcase_25 AC 40 ms
55,596 KB
testcase_26 AC 41 ms
55,604 KB
testcase_27 AC 41 ms
55,596 KB
testcase_28 AC 40 ms
55,596 KB
testcase_29 AC 40 ms
55,604 KB
testcase_30 AC 40 ms
55,596 KB
testcase_31 AC 40 ms
55,596 KB
testcase_32 AC 126 ms
76,436 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 f==1:
  print(-1)
else:
  print(dp[-1])  
0