結果
| 問題 |
No.2402 Dirty Stairs and Shoes
|
| コンテスト | |
| ユーザー |
n_na
|
| 提出日時 | 2023-08-05 22:51:15 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 132 ms / 2,000 ms |
| コード長 | 514 bytes |
| コンパイル時間 | 469 ms |
| コンパイル使用メモリ | 82,420 KB |
| 実行使用メモリ | 110,144 KB |
| 最終ジャッジ日時 | 2024-12-20 02:49:10 |
| 合計ジャッジ時間 | 3,675 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 32 |
ソースコード
N,K = map(int,input().split())
M1 = int(input())
A = list(map(int,input().split()))
A = set(A)
M2 = int(input())
B = list(map(int,input().split()))
B = set(B)
dp = [False]*(N+1)
dp[0] = True
for i in range(N):
n1 = i + 1
if n1 in B:
dp[n1] = True
if n1 not in A and dp[i]:
dp[n1] = True
n2 = i + K
if n2 > N:
continue
if n2 in B:
dp[n2] = True
if n2 not in A and dp[i]:
dp[n2] = True
if dp[N]:
print("Yes")
else:
print("No")
n_na