結果
| 問題 | No.2402 Dirty Stairs and Shoes |
| コンテスト | |
| ユーザー |
bit_kyopro
|
| 提出日時 | 2023-08-04 21:57:32 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 78 ms / 2,000 ms |
| コード長 | 508 bytes |
| 記録 | |
| コンパイル時間 | 234 ms |
| コンパイル使用メモリ | 84,992 KB |
| 実行使用メモリ | 99,200 KB |
| 最終ジャッジ日時 | 2026-05-27 06:28:53 |
| 合計ジャッジ時間 | 2,885 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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