結果

問題 No.2693 Sword
ユーザー hato336hato336
提出日時 2024-03-22 21:30:38
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 863 bytes
コンパイル時間 217 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 89,272 KB
最終ジャッジ日時 2024-03-22 21:30:45
合計ジャッジ時間 6,368 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
85,048 KB
testcase_01 AC 130 ms
85,048 KB
testcase_02 AC 130 ms
85,048 KB
testcase_03 AC 127 ms
85,048 KB
testcase_04 AC 128 ms
85,048 KB
testcase_05 AC 126 ms
85,048 KB
testcase_06 AC 128 ms
85,048 KB
testcase_07 AC 128 ms
85,048 KB
testcase_08 AC 155 ms
85,048 KB
testcase_09 AC 166 ms
89,144 KB
testcase_10 AC 149 ms
88,888 KB
testcase_11 AC 155 ms
89,144 KB
testcase_12 AC 130 ms
85,048 KB
testcase_13 AC 154 ms
89,272 KB
testcase_14 AC 140 ms
88,376 KB
testcase_15 AC 159 ms
89,016 KB
testcase_16 AC 163 ms
89,144 KB
testcase_17 AC 159 ms
89,016 KB
testcase_18 AC 148 ms
88,888 KB
testcase_19 AC 163 ms
89,144 KB
testcase_20 AC 158 ms
89,144 KB
testcase_21 AC 159 ms
89,272 KB
testcase_22 AC 197 ms
89,144 KB
testcase_23 AC 160 ms
89,144 KB
testcase_24 AC 128 ms
85,048 KB
testcase_25 WA -
testcase_26 AC 130 ms
85,048 KB
testcase_27 WA -
testcase_28 AC 131 ms
85,048 KB
testcase_29 AC 139 ms
85,048 KB
testcase_30 AC 131 ms
85,048 KB
testcase_31 AC 129 ms
85,048 KB
testcase_32 AC 158 ms
88,632 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections,sys,math,functools,operator,itertools,bisect,heapq,decimal,string,time,random
#sys.setrecursionlimit(10**9)
#sys.set_int_max_str_digits(0)
input = sys.stdin.readline
#n = int(input())
#alist = list(map(int,input().split()))
#alist = []
#s = input()
n,p,k = map(int,input().split())
item =[list(map(int,input().split())) for i in range(n)]

dp = [[-10**18 for i in range(k+1)] for j in range(n+1)]
dp[0][0] = p
for i in range(n):
    for j in range(k+1):
        if dp[i][j] >= 10**18:
            print(-1)
            exit()
        if dp[i][j] == -10**18:
            continue
        dp[i+1][j] = max(dp[i+1][j],dp[i][j])
        if j+1<=k:
            if item[i][0] == 1:
                dp[i+1][j+1] = max(dp[i+1][j+1],dp[i][j] + item[i][1])
            else:
                dp[i+1][j+1] = max(dp[i+1][j+1],dp[i][j] * 2)
print(dp[-1][-1])
0