結果

問題 No.2402 Dirty Stairs and Shoes
ユーザー 👑 timitimi
提出日時 2023-08-04 21:44:45
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 230 ms / 2,000 ms
コード長 856 bytes
コンパイル時間 1,306 ms
コンパイル使用メモリ 82,688 KB
実行使用メモリ 153,284 KB
最終ジャッジ日時 2024-05-10 07:16:12
合計ジャッジ時間 4,613 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
52,352 KB
testcase_01 AC 36 ms
52,096 KB
testcase_02 AC 35 ms
52,352 KB
testcase_03 AC 161 ms
108,692 KB
testcase_04 AC 91 ms
80,896 KB
testcase_05 AC 230 ms
153,284 KB
testcase_06 AC 111 ms
94,592 KB
testcase_07 AC 91 ms
80,768 KB
testcase_08 AC 109 ms
84,352 KB
testcase_09 AC 116 ms
94,848 KB
testcase_10 AC 170 ms
105,116 KB
testcase_11 AC 111 ms
93,824 KB
testcase_12 AC 96 ms
82,048 KB
testcase_13 AC 105 ms
93,952 KB
testcase_14 AC 111 ms
96,128 KB
testcase_15 AC 91 ms
94,976 KB
testcase_16 AC 66 ms
73,600 KB
testcase_17 AC 106 ms
95,360 KB
testcase_18 AC 104 ms
94,336 KB
testcase_19 AC 109 ms
94,976 KB
testcase_20 AC 104 ms
95,488 KB
testcase_21 AC 46 ms
61,056 KB
testcase_22 AC 89 ms
88,704 KB
testcase_23 AC 62 ms
72,704 KB
testcase_24 AC 89 ms
87,936 KB
testcase_25 AC 102 ms
95,616 KB
testcase_26 AC 91 ms
88,832 KB
testcase_27 AC 105 ms
95,616 KB
testcase_28 AC 105 ms
94,464 KB
testcase_29 AC 86 ms
88,448 KB
testcase_30 AC 51 ms
62,848 KB
testcase_31 AC 112 ms
95,488 KB
testcase_32 AC 65 ms
74,112 KB
testcase_33 AC 37 ms
52,352 KB
testcase_34 AC 67 ms
74,496 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()))
if N==1:
  print('Yes')
  exit()
dp=[[-1,-1] for _ in range(2*(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