結果

問題 No.2402 Dirty Stairs and Shoes
ユーザー bit_kyoprobit_kyopro
提出日時 2023-08-04 21:57:32
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 132 ms / 2,000 ms
コード長 508 bytes
コンパイル時間 294 ms
コンパイル使用メモリ 87,060 KB
実行使用メモリ 95,768 KB
最終ジャッジ日時 2023-08-23 01:43:33
合計ジャッジ時間 4,944 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,136 KB
testcase_01 AC 75 ms
71,312 KB
testcase_02 AC 73 ms
71,324 KB
testcase_03 AC 126 ms
87,444 KB
testcase_04 AC 94 ms
76,508 KB
testcase_05 AC 132 ms
95,768 KB
testcase_06 AC 99 ms
81,148 KB
testcase_07 AC 94 ms
77,152 KB
testcase_08 AC 103 ms
78,052 KB
testcase_09 AC 117 ms
81,552 KB
testcase_10 AC 126 ms
85,904 KB
testcase_11 AC 108 ms
82,632 KB
testcase_12 AC 111 ms
77,724 KB
testcase_13 AC 90 ms
78,192 KB
testcase_14 AC 88 ms
79,172 KB
testcase_15 AC 88 ms
77,980 KB
testcase_16 AC 88 ms
77,136 KB
testcase_17 AC 92 ms
78,644 KB
testcase_18 AC 90 ms
77,672 KB
testcase_19 AC 92 ms
79,108 KB
testcase_20 AC 91 ms
78,264 KB
testcase_21 AC 81 ms
76,176 KB
testcase_22 AC 87 ms
77,524 KB
testcase_23 AC 85 ms
77,052 KB
testcase_24 AC 89 ms
77,492 KB
testcase_25 AC 90 ms
78,708 KB
testcase_26 AC 87 ms
77,248 KB
testcase_27 AC 90 ms
78,696 KB
testcase_28 AC 90 ms
78,352 KB
testcase_29 AC 86 ms
77,236 KB
testcase_30 AC 85 ms
75,976 KB
testcase_31 AC 92 ms
79,072 KB
testcase_32 AC 84 ms
77,216 KB
testcase_33 AC 71 ms
71,424 KB
testcase_34 AC 87 ms
77,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k = map(int, input().split())
m1 = int(input())
a = list(map(int, input().split()))
m2 = int(input())
b = list(map(int, input().split()))
x = [0 for _ in range(n + 1)]

for val in a:
    x[val] = 1
for val in b:
    x[val] = 2

dp = [False for _ in range(n + 1)]
dp[0] = True

for i in range(n):
    if (dp[i] and x[i + 1] == 0) or x[i + 1] == 2:
        dp[i + 1] = True
    if i + k <= n and ((dp[i] and x[i + k] == 0) or x[i + k] == 2):
        dp[i + k] = True
        
print('Yes' if dp[n] else 'No')
0