結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
51,968 KB
testcase_01 AC 41 ms
51,968 KB
testcase_02 AC 41 ms
51,712 KB
testcase_03 AC 179 ms
100,988 KB
testcase_04 AC 98 ms
79,360 KB
testcase_05 AC 236 ms
137,584 KB
testcase_06 AC 125 ms
93,952 KB
testcase_07 AC 99 ms
78,592 KB
testcase_08 AC 122 ms
80,896 KB
testcase_09 AC 138 ms
93,312 KB
testcase_10 AC 175 ms
97,120 KB
testcase_11 AC 120 ms
92,928 KB
testcase_12 AC 108 ms
80,128 KB
testcase_13 AC 101 ms
85,888 KB
testcase_14 AC 118 ms
93,056 KB
testcase_15 AC 70 ms
71,680 KB
testcase_16 AC 75 ms
69,248 KB
testcase_17 AC 111 ms
88,576 KB
testcase_18 AC 85 ms
74,496 KB
testcase_19 AC 115 ms
91,136 KB
testcase_20 AC 104 ms
88,064 KB
testcase_21 AC 52 ms
60,416 KB
testcase_22 AC 77 ms
71,552 KB
testcase_23 AC 67 ms
67,584 KB
testcase_24 AC 79 ms
72,832 KB
testcase_25 AC 108 ms
90,624 KB
testcase_26 AC 78 ms
70,656 KB
testcase_27 AC 114 ms
91,392 KB
testcase_28 AC 105 ms
86,528 KB
testcase_29 AC 75 ms
70,784 KB
testcase_30 AC 59 ms
62,592 KB
testcase_31 AC 120 ms
91,392 KB
testcase_32 AC 73 ms
68,608 KB
testcase_33 AC 42 ms
52,224 KB
testcase_34 AC 75 ms
70,400 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 _ in range(N+2*K)]
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