結果

問題 No.2402 Dirty Stairs and Shoes
ユーザー やでな@競プロやでな@競プロ
提出日時 2023-10-08 21:09:11
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 704 bytes
コンパイル時間 364 ms
コンパイル使用メモリ 87,332 KB
実行使用メモリ 112,508 KB
最終ジャッジ日時 2023-10-08 21:09:18
合計ジャッジ時間 6,259 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 102 ms
71,900 KB
testcase_01 AC 88 ms
71,696 KB
testcase_02 AC 92 ms
71,840 KB
testcase_03 AC 178 ms
98,760 KB
testcase_04 AC 130 ms
78,812 KB
testcase_05 AC 211 ms
112,508 KB
testcase_06 AC 135 ms
90,624 KB
testcase_07 AC 154 ms
82,256 KB
testcase_08 AC 130 ms
84,440 KB
testcase_09 AC 144 ms
93,632 KB
testcase_10 AC 175 ms
96,820 KB
testcase_11 AC 175 ms
93,148 KB
testcase_12 AC 133 ms
81,148 KB
testcase_13 AC 122 ms
95,012 KB
testcase_14 AC 130 ms
107,028 KB
testcase_15 AC 115 ms
94,628 KB
testcase_16 AC 106 ms
83,624 KB
testcase_17 AC 124 ms
99,564 KB
testcase_18 AC 116 ms
92,712 KB
testcase_19 AC 144 ms
102,388 KB
testcase_20 AC 123 ms
99,216 KB
testcase_21 AC 97 ms
77,840 KB
testcase_22 AC 112 ms
88,604 KB
testcase_23 AC 109 ms
87,388 KB
testcase_24 AC 112 ms
87,476 KB
testcase_25 AC 128 ms
101,800 KB
testcase_26 AC 110 ms
88,288 KB
testcase_27 AC 130 ms
104,948 KB
testcase_28 AC 120 ms
94,968 KB
testcase_29 AC 111 ms
88,244 KB
testcase_30 AC 98 ms
77,712 KB
testcase_31 AC 131 ms
105,380 KB
testcase_32 AC 111 ms
88,172 KB
testcase_33 WA -
testcase_34 AC 111 ms
85,412 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()))

from collections import *
da = defaultdict(int)
db = defaultdict(int)
for i in a:
    da[i] += 1
for i in b:
    db[i] += 1

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

for i in range(0,n):
    if dp[i] == True:
        if da[i] == 0:
            dp[i+1] = True
        if 0 <= i+k <= n:
            if da[i+k] == 0:
                dp[i+k] = True
    elif dp[i] == False:
        if db[i+1] == 1:
            dp[i+1] = True
        if 0 <= i+k <= n:
            if db[i+k] == 1:
                dp[i+k] = True
                
if dp[-1]:
    print("Yes")
else:
    print("No")
0