結果
| 問題 |
No.3077 Goodstuff Deck Builder(Hard)
|
| コンテスト | |
| ユーザー |
ゼット
|
| 提出日時 | 2025-03-28 23:27:14 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 448 bytes |
| コンパイル時間 | 251 ms |
| コンパイル使用メモリ | 82,216 KB |
| 実行使用メモリ | 221,680 KB |
| 最終ジャッジ日時 | 2025-03-28 23:28:15 |
| 合計ジャッジ時間 | 45,511 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 47 WA * 10 |
ソースコード
N,M=map(int,input().split())
dp=[0]*(M+1)
np=[0]*(M+1)
L=[]
p=0
for i in range(N):
c,d=map(int,input().split())
if c==0:
p+=d
else:
L.append((c,d))
L.sort()
N=len(L)
result=0
for i in range(N):
a,b=L[i][:]
for x in range(a,M+1):
np[x]=max(dp[x-a]+b,np[x])
for x in range(a):
np[x]=dp[x]
w=max(np)
result=max(result,w)
for x in range(M+1):
if x%2==0:
dp[x]=np[x//2]
else:
dp[x]=0
print(result+p)
ゼット