結果

問題 No.2402 Dirty Stairs and Shoes
ユーザー maron8676
提出日時 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
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict, deque
from sys import stdin

readline = stdin.readline


def 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] = 1
for b in B:
    ans[b] = 1

for i in range(N):
    if ans[i] == 0:
        continue

    if i + 1 not in A_set:
        ans[i + 1] = 1
    if i + K <= N and i + K not in A_set:
        ans[i + K] = 1

if ans[N] == 1:
    print("Yes")
else:
    print("No")
0