結果

問題 No.2402 Dirty Stairs and Shoes
ユーザー なえしら
提出日時 2024-08-16 22:53:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 74 ms / 2,000 ms
コード長 341 bytes
コンパイル時間 231 ms
コンパイル使用メモリ 82,580 KB
実行使用メモリ 91,188 KB
最終ジャッジ日時 2024-08-16 22:53:38
合計ジャッジ時間 3,536 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

N, K = map(int, input().split())
M = int(input())
A = list(map(int, input().split()))
M = int(input())
B = list(map(int, input().split()))

dp = [True] + [None] * N
for a in A: dp[a] = False
for b in B: dp[b] = True

for i in range(1, N + 1):
  if dp[i] is None:
    dp[i] = dp[i - 1] or i >= K and dp[i - K]

print("Yes" if dp[N] else "No")
0