結果

問題 No.2434 RAKUTAN de RAKUTAN
ユーザー shobonvipshobonvip
提出日時 2023-08-11 21:17:22
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 589 bytes
コンパイル時間 320 ms
コンパイル使用メモリ 82,836 KB
実行使用メモリ 849,040 KB
最終ジャッジ日時 2024-04-30 11:12:44
合計ジャッジ時間 2,410 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
59,036 KB
testcase_01 AC 40 ms
58,944 KB
testcase_02 AC 41 ms
60,672 KB
testcase_03 MLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

n, h, x = map(int,input().split())
G = int(input())
g = list(map(int,input().split()))
B = int(input())
b = list(map(int,input().split()))
score = [0] * n
for i in range(G): score[g[i]-1] = 1
for i in range(B): score[b[i]-1] = -1
dp = [[10 ** 9 for i in range(201)] for j in range(n+1)]
dp[0][100] = 0
for i in range(n):
	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])

ans = -200
for i in range(201):
	if dp[n][i] <= h:
		ans = max(ans, i - 100)

print(ans)
0