結果

問題 No.2402 Dirty Stairs and Shoes
ユーザー KudeKude
提出日時 2023-08-04 21:38:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 121 ms / 2,000 ms
コード長 418 bytes
コンパイル時間 285 ms
コンパイル使用メモリ 86,872 KB
実行使用メモリ 88,336 KB
最終ジャッジ日時 2023-08-23 01:41:34
合計ジャッジ時間 4,756 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,512 KB
testcase_01 AC 75 ms
71,400 KB
testcase_02 AC 78 ms
71,400 KB
testcase_03 AC 111 ms
83,400 KB
testcase_04 AC 92 ms
76,572 KB
testcase_05 AC 121 ms
88,336 KB
testcase_06 AC 103 ms
80,040 KB
testcase_07 AC 94 ms
76,796 KB
testcase_08 AC 94 ms
76,908 KB
testcase_09 AC 100 ms
79,236 KB
testcase_10 AC 113 ms
82,384 KB
testcase_11 AC 101 ms
79,700 KB
testcase_12 AC 101 ms
76,916 KB
testcase_13 AC 85 ms
77,876 KB
testcase_14 AC 84 ms
78,816 KB
testcase_15 AC 83 ms
77,716 KB
testcase_16 AC 83 ms
76,648 KB
testcase_17 AC 86 ms
78,128 KB
testcase_18 AC 84 ms
77,596 KB
testcase_19 AC 85 ms
78,572 KB
testcase_20 AC 84 ms
78,184 KB
testcase_21 AC 79 ms
76,000 KB
testcase_22 AC 84 ms
77,048 KB
testcase_23 AC 81 ms
77,080 KB
testcase_24 AC 83 ms
77,056 KB
testcase_25 AC 83 ms
78,592 KB
testcase_26 AC 82 ms
76,956 KB
testcase_27 AC 84 ms
78,576 KB
testcase_28 AC 85 ms
77,768 KB
testcase_29 AC 82 ms
77,024 KB
testcase_30 AC 80 ms
75,952 KB
testcase_31 AC 85 ms
78,792 KB
testcase_32 AC 80 ms
76,908 KB
testcase_33 AC 73 ms
71,380 KB
testcase_34 AC 84 ms
76,704 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k = map(int, input().split())
d = [0] * (n + 1)
input()
for a in map(int, input().split()):
    d[a] = 1
input()
for b in map(int, input().split()):
    d[b] = 2

dp = [0] * (n + 1)
dp[0] = 2
for i in range(1, n + 1):
    v = dp[i - 1]
    if i - k >= 0:
        v = max(v, dp[i - k])
    if d[i] == 1:
        v = min(v, 1)
    elif d[i] == 2 and v:
        v = 2
    dp[i] = v
print('Yes' if dp[n] == 2 else 'No')
0