結果
問題 | No.2402 Dirty Stairs and Shoes |
ユーザー |
|
提出日時 | 2023-08-04 21:40:08 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 155 ms / 2,000 ms |
コード長 | 522 bytes |
コンパイル時間 | 268 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 24,708 KB |
最終ジャッジ日時 | 2024-12-20 02:31:41 |
合計ジャッジ時間 | 4,270 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 32 |
ソースコード
from collections import defaultdict, dequefrom sys import stdinreadline = stdin.readlinedef li():return list(map(int, readline().split()))N, K = li()M1 = int(input())A = li()M2 = int(input())B = li()A_set = set(A)ans = [0] * (N + 1)ans[0] = 1for b in B:ans[b] = 1for i in range(N):if ans[i] == 0:continueif i + 1 not in A_set:ans[i + 1] = 1if i + K <= N and i + K not in A_set:ans[i + K] = 1if ans[N] == 1:print("Yes")else:print("No")