結果

問題 No.2402 Dirty Stairs and Shoes
ユーザー 👑 timitimi
提出日時 2023-08-04 21:37:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 193 ms / 2,000 ms
コード長 819 bytes
コンパイル時間 358 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 122,364 KB
最終ジャッジ日時 2024-05-10 07:10:31
合計ジャッジ時間 4,399 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
52,096 KB
testcase_01 AC 36 ms
52,096 KB
testcase_02 AC 35 ms
51,584 KB
testcase_03 AC 142 ms
98,896 KB
testcase_04 AC 84 ms
78,208 KB
testcase_05 AC 193 ms
122,364 KB
testcase_06 AC 104 ms
93,184 KB
testcase_07 AC 88 ms
78,848 KB
testcase_08 AC 106 ms
80,768 KB
testcase_09 AC 118 ms
92,032 KB
testcase_10 AC 149 ms
95,912 KB
testcase_11 AC 103 ms
91,392 KB
testcase_12 AC 95 ms
79,360 KB
testcase_13 AC 91 ms
86,272 KB
testcase_14 AC 108 ms
93,184 KB
testcase_15 AC 63 ms
71,424 KB
testcase_16 AC 65 ms
69,504 KB
testcase_17 AC 102 ms
88,832 KB
testcase_18 AC 79 ms
74,496 KB
testcase_19 AC 106 ms
90,752 KB
testcase_20 AC 94 ms
88,064 KB
testcase_21 AC 47 ms
60,160 KB
testcase_22 AC 71 ms
71,424 KB
testcase_23 AC 61 ms
67,200 KB
testcase_24 AC 72 ms
72,960 KB
testcase_25 AC 96 ms
91,008 KB
testcase_26 AC 69 ms
71,168 KB
testcase_27 AC 99 ms
91,136 KB
testcase_28 AC 97 ms
86,656 KB
testcase_29 AC 69 ms
70,656 KB
testcase_30 AC 52 ms
62,464 KB
testcase_31 AC 106 ms
91,904 KB
testcase_32 AC 64 ms
68,736 KB
testcase_33 AC 37 ms
51,968 KB
testcase_34 AC 69 ms
70,912 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K=map(int, input().split())
M=int(input())
A=list(map(int, input().split()))
L=int(input())
B=list(map(int, input().split()))
dp=[[-1,-1] for i in range(N+K+1)]
dp[0]=[1,-1]
A,B=set(A),set(B)
for i in range(N):
  if i+1 in A:
    if dp[i][0]==1:
      dp[i+1][1]=1
    if dp[i][1]==1:
      dp[i+1][1]=1
  elif i+1 in B:
    if dp[i][0]==1:
      dp[i+1][0]=1
    if dp[i][1]==1:
      dp[i+1][0]=1
  else:
    if dp[i][0]==1:
      dp[i+1][0]=1
    if dp[i][1]==1:
      dp[i+1][1]=1
      
  if i+K in A:
    if dp[i][0]==1:
      dp[i+K][1]=1
    if dp[i][1]==1:
      dp[i+K][1]=1
  elif i+K in B:
    if dp[i][0]==1:
      dp[i+K][0]=1
    if dp[i][1]==1:
      dp[i+K][0]=1
  else:
    if dp[i][0]==1:
      dp[i+K][0]=1
    if dp[i][1]==1:
      dp[i+K][1]=1

if dp[N][0]==1:
  print('Yes')
else:
  print('No')
0