結果

問題 No.2402 Dirty Stairs and Shoes
ユーザー やでな@競プロやでな@競プロ
提出日時 2023-10-08 21:14:45
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 204 ms / 2,000 ms
コード長 753 bytes
コンパイル時間 416 ms
コンパイル使用メモリ 87,300 KB
実行使用メモリ 113,420 KB
最終ジャッジ日時 2023-10-08 21:14:52
合計ジャッジ時間 6,332 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 87 ms
71,816 KB
testcase_01 AC 91 ms
71,696 KB
testcase_02 AC 93 ms
71,884 KB
testcase_03 AC 185 ms
98,636 KB
testcase_04 AC 132 ms
78,612 KB
testcase_05 AC 204 ms
113,420 KB
testcase_06 AC 133 ms
90,636 KB
testcase_07 AC 130 ms
80,928 KB
testcase_08 AC 137 ms
85,244 KB
testcase_09 AC 150 ms
94,276 KB
testcase_10 AC 174 ms
98,096 KB
testcase_11 AC 170 ms
91,120 KB
testcase_12 AC 137 ms
81,312 KB
testcase_13 AC 127 ms
95,284 KB
testcase_14 AC 137 ms
107,272 KB
testcase_15 AC 120 ms
93,648 KB
testcase_16 AC 112 ms
83,692 KB
testcase_17 AC 132 ms
99,836 KB
testcase_18 AC 123 ms
92,884 KB
testcase_19 AC 151 ms
102,484 KB
testcase_20 AC 127 ms
99,184 KB
testcase_21 AC 97 ms
77,544 KB
testcase_22 AC 118 ms
88,720 KB
testcase_23 AC 110 ms
84,800 KB
testcase_24 AC 119 ms
87,604 KB
testcase_25 AC 131 ms
102,116 KB
testcase_26 AC 119 ms
88,468 KB
testcase_27 AC 146 ms
105,064 KB
testcase_28 AC 128 ms
95,188 KB
testcase_29 AC 115 ms
88,216 KB
testcase_30 AC 101 ms
77,768 KB
testcase_31 AC 137 ms
105,400 KB
testcase_32 AC 110 ms
88,424 KB
testcase_33 AC 95 ms
71,692 KB
testcase_34 AC 117 ms
85,512 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+1] == 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
                
    #print(dp,i)
                
if dp[-1]:
    print("Yes")
else:
    print("No")
            
0