結果

問題 No.2434 RAKUTAN de RAKUTAN
ユーザー shobonvipshobonvip
提出日時 2023-08-12 02:48:31
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 715 bytes
コンパイル時間 220 ms
コンパイル使用メモリ 82,012 KB
実行使用メモリ 111,544 KB
最終ジャッジ日時 2024-04-30 11:13:37
合計ジャッジ時間 8,337 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
58,472 KB
testcase_01 AC 46 ms
60,508 KB
testcase_02 AC 45 ms
60,092 KB
testcase_03 AC 1,452 ms
111,172 KB
testcase_04 AC 1,458 ms
111,240 KB
testcase_05 AC 1,453 ms
111,544 KB
testcase_06 AC 1,451 ms
111,200 KB
testcase_07 AC 39 ms
52,796 KB
testcase_08 AC 38 ms
52,992 KB
testcase_09 AC 38 ms
52,528 KB
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 AC 47 ms
58,744 KB
testcase_23 AC 47 ms
62,132 KB
testcase_24 AC 47 ms
60,088 KB
testcase_25 AC 46 ms
60,424 KB
testcase_26 AC 48 ms
59,800 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, h, x = map(int,input().split())
G = int(input())
if G >= 1:
	g = list(map(int,input().split()))
else:
	g = []
	input()
B = int(input())
if B >= 1:
	b = list(map(int,input().split()))
else:
	b = []
	input()
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)
0