結果
| 問題 |
No.2402 Dirty Stairs and Shoes
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-08-04 21:44:08 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 488 bytes |
| コンパイル時間 | 318 ms |
| コンパイル使用メモリ | 81,976 KB |
| 実行使用メモリ | 848,868 KB |
| 最終ジャッジ日時 | 2024-12-20 02:36:01 |
| 合計ジャッジ時間 | 13,510 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 21 WA * 6 MLE * 5 |
ソースコード
n,k=map(int,input().split())
a=int(input())
A=list(map(int,input().split()))
b=int(input())
B=list(map(int,input().split()))
SA,SB=set(A),set(B)
dp=[[0,0] for _ in range(n+1)]
dp[0][0]=1
for i in range(n):
if i in SA:
if dp[i][0]:
dp[i][0]=0
dp[i][1]=1
if i in SB:
if dp[i][1]:
dp[i][1]=0
dp[i][0]=1
dp[i+1][0]+=dp[i][0]
dp[i+1][0]+=dp[i][1]
if i+k<=n:
dp[i+k][0]+=dp[i][0]
dp[i+k][1]+=dp[i][1]
print("Yes" if dp[n][0] else "No")