結果
| 問題 |
No.2402 Dirty Stairs and Shoes
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-05-23 12:43:26 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 164 ms / 2,000 ms |
| コード長 | 487 bytes |
| コンパイル時間 | 369 ms |
| コンパイル使用メモリ | 12,032 KB |
| 実行使用メモリ | 23,668 KB |
| 最終ジャッジ日時 | 2025-05-23 12:43:31 |
| 合計ジャッジ時間 | 5,155 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 32 |
ソースコード
n, k = map(int, input().split())
m1 = int(input())
a = list(map(int, input().split()))
m2 = int(input())
b = list(map(int, input().split()))
dirty = set(a)
clean = set(b)
dp = [False] * (n + 1)
dp[0] = True
for i in range(1, n + 1):
if i in dirty:
dp[i] = False
elif i in clean:
dp[i] = True
else:
if i - 1 >= 0 and dp[i - 1]:
dp[i] = True
if i - k >= 0 and dp[i - k]:
dp[i] = True
print("Yes" if dp[n] else "No")