結果
問題 | No.2693 Sword |
ユーザー |
![]() |
提出日時 | 2024-03-22 21:31:48 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 68 ms / 2,000 ms |
コード長 | 869 bytes |
コンパイル時間 | 314 ms |
コンパイル使用メモリ | 82,272 KB |
実行使用メモリ | 74,676 KB |
最終ジャッジ日時 | 2024-09-30 10:56:10 |
合計ジャッジ時間 | 2,830 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 29 |
ソースコード
############################################################# 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))