結果

問題 No.2402 Dirty Stairs and Shoes
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2023-08-04 22:06:32
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 112 ms / 2,000 ms
コード長 568 bytes
コンパイル時間 276 ms
コンパイル使用メモリ 87,112 KB
実行使用メモリ 94,996 KB
最終ジャッジ日時 2023-08-23 01:43:50
合計ジャッジ時間 4,595 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,116 KB
testcase_01 AC 71 ms
71,136 KB
testcase_02 AC 74 ms
71,380 KB
testcase_03 AC 99 ms
86,400 KB
testcase_04 AC 86 ms
76,344 KB
testcase_05 AC 112 ms
94,996 KB
testcase_06 AC 87 ms
80,824 KB
testcase_07 AC 83 ms
76,632 KB
testcase_08 AC 84 ms
76,968 KB
testcase_09 AC 90 ms
80,500 KB
testcase_10 AC 99 ms
84,968 KB
testcase_11 AC 91 ms
81,440 KB
testcase_12 AC 86 ms
76,568 KB
testcase_13 AC 84 ms
78,116 KB
testcase_14 AC 85 ms
78,704 KB
testcase_15 AC 83 ms
77,516 KB
testcase_16 AC 81 ms
76,940 KB
testcase_17 AC 83 ms
78,180 KB
testcase_18 AC 82 ms
77,488 KB
testcase_19 AC 85 ms
78,576 KB
testcase_20 AC 81 ms
77,924 KB
testcase_21 AC 76 ms
75,884 KB
testcase_22 AC 80 ms
77,320 KB
testcase_23 AC 81 ms
76,648 KB
testcase_24 AC 80 ms
77,436 KB
testcase_25 AC 83 ms
78,392 KB
testcase_26 AC 82 ms
76,824 KB
testcase_27 AC 84 ms
78,320 KB
testcase_28 AC 85 ms
78,088 KB
testcase_29 AC 79 ms
76,820 KB
testcase_30 AC 80 ms
75,816 KB
testcase_31 AC 86 ms
79,004 KB
testcase_32 AC 83 ms
76,928 KB
testcase_33 AC 73 ms
71,108 KB
testcase_34 AC 80 ms
77,104 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

"""

"""

import sys
from sys import stdin

N,K = map(int,stdin.readline().split())
_ = input()
A = list(map(int,stdin.readline().split()))
_ = input()
B = list(map(int,stdin.readline().split()))

lis = [0] * (N+1)


for na in A:
    lis[na] = 1

for nb in B:
    lis[nb] = 2

dp = [False] * (N+1)
dp[0] = True

for i in range(N):

    if lis[i] == 1:
        dp[i] = False
    if lis[i] == 2:
        dp[i] = True
    
    if dp[i]:
        dp[i+1] = True
        if i+K <= N:
            dp[i+K] = True

if dp[-1]:
    print ("Yes")
else:
    print ("No")
        
0