結果
問題 |
No.2434 RAKUTAN de RAKUTAN
|
ユーザー |
![]() |
提出日時 | 2023-08-12 02:49:47 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 697 bytes |
コンパイル時間 | 452 ms |
コンパイル使用メモリ | 82,560 KB |
実行使用メモリ | 111,532 KB |
最終ジャッジ日時 | 2024-11-20 05:32:58 |
合計ジャッジ時間 | 7,964 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 9 RE * 15 |
ソースコード
n, h, x = map(int,input().split()) G = int(input()) if G >= 1: g = list(map(int,input().split())) else: g = [] B = int(input()) if B >= 1: b = list(map(int,input().split())) else: b = [] score = [0] * n for i in range(G): score[g[i]-1] = 1 for i in range(B): score[b[i]-1] = -1 dp = [[] for j in range(n+1)] dp[0] = [10 ** 9] * 201 dp[0][100] = 0 for i in range(n): dp[i+1] = [10 ** 9] * 201 for j in range(201): if not (0 <= j+score[i] <= 200): continue if i+1-x < 0: dp[i+1][j+score[i]] = dp[i][j] else: dp[i+1][j+score[i]] = min(dp[i+1-x][j]+1, dp[i][j]) if i+1-x >= 0: dp[i+1-x] = [] ans = -200 for i in range(201): if dp[n][i] <= h: ans = max(ans, i - 100) print(ans)