結果
| 問題 |
No.2402 Dirty Stairs and Shoes
|
| コンテスト | |
| ユーザー |
bit_kyopro
|
| 提出日時 | 2023-08-04 21:57:32 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 107 ms / 2,000 ms |
| コード長 | 508 bytes |
| コンパイル時間 | 307 ms |
| コンパイル使用メモリ | 82,520 KB |
| 実行使用メモリ | 94,224 KB |
| 最終ジャッジ日時 | 2024-12-20 02:40:10 |
| 合計ジャッジ時間 | 3,500 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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()))
x = [0 for _ in range(n + 1)]
for val in a:
x[val] = 1
for val in b:
x[val] = 2
dp = [False for _ in range(n + 1)]
dp[0] = True
for i in range(n):
if (dp[i] and x[i + 1] == 0) or x[i + 1] == 2:
dp[i + 1] = True
if i + k <= n and ((dp[i] and x[i + k] == 0) or x[i + k] == 2):
dp[i + k] = True
print('Yes' if dp[n] else 'No')
bit_kyopro