結果
| 問題 |
No.2402 Dirty Stairs and Shoes
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-08-05 17:19:01 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 764 bytes |
| コンパイル時間 | 183 ms |
| コンパイル使用メモリ | 82,384 KB |
| 実行使用メモリ | 95,088 KB |
| 最終ジャッジ日時 | 2024-12-20 02:48:30 |
| 合計ジャッジ時間 | 4,160 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 15 RE * 17 |
ソースコード
# import pypyjit
# pypyjit.set_param('max_unroll_recursion=-1')
from collections import *
from itertools import *
from functools import *
from heapq import *
import sys,math
# input = sys.stdin.readline
N,K = map(int,input().split())
M1 = int(input())
if M1!=0:
A = list(map(int,input().split()))
else:
A = set([])
M2 = int(input())
if M2!=0:
B = list(map(int,input().split()))
else:
B = set([])
B =set(B)
A = set(A)
dp = [-1]*(N+1)
dp[0]=1
def f(x):
if dp[x]!=-1:
return dp[x]
if x in A:
dp[x] = 0
return dp[x]
if x in B:
dp[x] = 1
return 1
if x>=K:
dp[x] = max(f(x-1),f(x-K))
return dp[x]
dp[x] = f(x-1)
return dp[x]
if f(N):
print('Yes')
else:
print('No')