結果

問題 No.2402 Dirty Stairs and Shoes
ユーザー komkompikomkompi
提出日時 2023-08-05 07:28:44
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 139 ms / 2,000 ms
コード長 534 bytes
コンパイル時間 354 ms
コンパイル使用メモリ 86,980 KB
実行使用メモリ 111,036 KB
最終ジャッジ日時 2023-08-23 01:45:28
合計ジャッジ時間 5,149 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
71,180 KB
testcase_01 AC 73 ms
71,224 KB
testcase_02 AC 72 ms
71,132 KB
testcase_03 AC 121 ms
98,000 KB
testcase_04 AC 86 ms
76,500 KB
testcase_05 AC 139 ms
111,036 KB
testcase_06 AC 100 ms
85,396 KB
testcase_07 AC 86 ms
77,476 KB
testcase_08 AC 90 ms
77,836 KB
testcase_09 AC 102 ms
84,572 KB
testcase_10 AC 119 ms
95,000 KB
testcase_11 AC 101 ms
87,032 KB
testcase_12 AC 87 ms
77,284 KB
testcase_13 AC 94 ms
77,804 KB
testcase_14 AC 106 ms
78,024 KB
testcase_15 AC 91 ms
77,140 KB
testcase_16 AC 87 ms
76,952 KB
testcase_17 AC 100 ms
78,064 KB
testcase_18 AC 93 ms
76,900 KB
testcase_19 AC 99 ms
78,244 KB
testcase_20 AC 96 ms
77,636 KB
testcase_21 AC 80 ms
76,088 KB
testcase_22 AC 90 ms
76,992 KB
testcase_23 AC 87 ms
76,640 KB
testcase_24 AC 89 ms
77,240 KB
testcase_25 AC 95 ms
77,744 KB
testcase_26 AC 91 ms
76,732 KB
testcase_27 AC 102 ms
77,860 KB
testcase_28 AC 98 ms
77,760 KB
testcase_29 AC 87 ms
76,620 KB
testcase_30 AC 79 ms
76,152 KB
testcase_31 AC 110 ms
78,252 KB
testcase_32 AC 91 ms
76,604 KB
testcase_33 AC 72 ms
71,300 KB
testcase_34 AC 87 ms
76,852 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8
# Your code here!
N,K=map(int,input().split())
M1=int(input())
A=list(map(int,input().split()))

M2=int(input())
B=list(map(int,input().split()))

stairs=[10**9]*(N+1)
stairs[0]=0

A=set(A)
B=set(B)

for i in range(N):
    for delta in [1,K]:
        nxt=i+delta
        if nxt>N:
            continue
        if nxt in A:
            stairs[nxt]=1
        elif nxt in B:
            stairs[nxt]=0
        else:
            stairs[nxt]=min(stairs[i],stairs[nxt])

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