結果

問題 No.2402 Dirty Stairs and Shoes
ユーザー KudeKude
提出日時 2023-08-04 21:42:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 128 ms / 2,000 ms
コード長 634 bytes
コンパイル時間 298 ms
コンパイル使用メモリ 87,080 KB
実行使用メモリ 93,848 KB
最終ジャッジ日時 2023-08-23 01:42:17
合計ジャッジ時間 4,895 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,140 KB
testcase_01 AC 77 ms
71,180 KB
testcase_02 AC 78 ms
71,180 KB
testcase_03 AC 119 ms
87,412 KB
testcase_04 AC 95 ms
76,096 KB
testcase_05 AC 128 ms
93,848 KB
testcase_06 AC 111 ms
81,788 KB
testcase_07 AC 100 ms
76,348 KB
testcase_08 AC 98 ms
76,832 KB
testcase_09 AC 103 ms
79,392 KB
testcase_10 AC 123 ms
85,700 KB
testcase_11 AC 105 ms
79,968 KB
testcase_12 AC 105 ms
76,884 KB
testcase_13 AC 87 ms
77,464 KB
testcase_14 AC 88 ms
78,612 KB
testcase_15 AC 86 ms
77,660 KB
testcase_16 AC 86 ms
76,464 KB
testcase_17 AC 88 ms
78,080 KB
testcase_18 AC 88 ms
77,596 KB
testcase_19 AC 88 ms
78,384 KB
testcase_20 AC 86 ms
77,760 KB
testcase_21 AC 81 ms
75,816 KB
testcase_22 AC 87 ms
76,896 KB
testcase_23 AC 85 ms
76,536 KB
testcase_24 AC 87 ms
76,948 KB
testcase_25 AC 85 ms
78,332 KB
testcase_26 AC 86 ms
76,972 KB
testcase_27 AC 86 ms
78,448 KB
testcase_28 AC 88 ms
77,420 KB
testcase_29 AC 84 ms
76,852 KB
testcase_30 AC 83 ms
75,624 KB
testcase_31 AC 87 ms
78,408 KB
testcase_32 AC 81 ms
76,728 KB
testcase_33 AC 74 ms
71,292 KB
testcase_34 AC 85 ms
76,400 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

inp = map(int, ''.join(open(0)).split())

n = next(inp)
k = next(inp)
# n, k = map(int, input().split())
d = [0] * (n + 1)
# input()
m1 = next(inp)
for _ in range(m1):
    a = next(inp)
    d[a] = 1
# for a in map(int, input().split()):
    # d[a] = 1
# input()
m2 = next(inp)
for _ in range(m2):
    b = next(inp)
    d[b] = 2
# 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