結果

問題 No.2693 Sword
ユーザー mymelochanmymelochan
提出日時 2024-03-22 21:31:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 74 ms / 2,000 ms
コード長 869 bytes
コンパイル時間 203 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 74,116 KB
最終ジャッジ日時 2024-03-22 21:31:52
合計ジャッジ時間 3,223 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 48 ms
55,600 KB
testcase_01 AC 44 ms
55,600 KB
testcase_02 AC 44 ms
55,600 KB
testcase_03 AC 45 ms
55,600 KB
testcase_04 AC 45 ms
55,600 KB
testcase_05 AC 45 ms
55,600 KB
testcase_06 AC 43 ms
55,600 KB
testcase_07 AC 44 ms
55,600 KB
testcase_08 AC 45 ms
55,600 KB
testcase_09 AC 66 ms
73,824 KB
testcase_10 AC 53 ms
64,032 KB
testcase_11 AC 58 ms
68,680 KB
testcase_12 AC 44 ms
55,600 KB
testcase_13 AC 56 ms
66,608 KB
testcase_14 AC 44 ms
55,600 KB
testcase_15 AC 57 ms
66,496 KB
testcase_16 AC 60 ms
68,556 KB
testcase_17 AC 50 ms
63,896 KB
testcase_18 AC 49 ms
61,772 KB
testcase_19 AC 65 ms
72,828 KB
testcase_20 AC 57 ms
66,640 KB
testcase_21 AC 62 ms
68,700 KB
testcase_22 AC 71 ms
74,116 KB
testcase_23 AC 58 ms
66,608 KB
testcase_24 AC 74 ms
55,600 KB
testcase_25 AC 45 ms
55,600 KB
testcase_26 AC 45 ms
55,600 KB
testcase_27 AC 45 ms
55,600 KB
testcase_28 AC 45 ms
55,600 KB
testcase_29 AC 46 ms
55,600 KB
testcase_30 AC 46 ms
55,600 KB
testcase_31 AC 44 ms
55,600 KB
testcase_32 AC 52 ms
63,640 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#############################################################

import sys
sys.setrecursionlimit(10**7)

from heapq import heappop,heappush
from collections import deque,defaultdict,Counter
from bisect import bisect_left, bisect_right
from itertools import product,combinations,permutations

ipt = sys.stdin.readline

def iin():
    return int(ipt())
def lmin():
    return list(map(int,ipt().split()))

MOD = 998244353
#############################################################

N,P,K = lmin()
L = [lmin() for _ in range(N)]

dp = [-1]*(K+1)
dp[0] = P

for t,b in L:
    ndp = dp[:]
    for j in range(K):
        if dp[j] == -1:
            break
        if t == 1:
            ndp[j+1] = max(ndp[j+1],dp[j]+b)
        else:
            ndp[j+1] = max(ndp[j+1],dp[j]*2)
    dp = ndp
    if max(dp) > 10**18:
        print(-1)
        exit()

print(max(dp))
        
0