結果
問題 | No.2402 Dirty Stairs and Shoes |
ユーザー |
![]() |
提出日時 | 2023-08-04 22:07:29 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 96 ms / 2,000 ms |
コード長 | 597 bytes |
コンパイル時間 | 156 ms |
コンパイル使用メモリ | 82,460 KB |
実行使用メモリ | 100,280 KB |
最終ジャッジ日時 | 2024-12-20 02:40:47 |
合計ジャッジ時間 | 3,039 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 32 |
ソースコード
N, K = map(int, input().split()) M1 = int(input()) A = set(map(int, input().split())) M2 = int(input()) B = set(map(int, input().split())) dp = [ False ] * (N+1) dp[0] = True for i in range(1, N+1): if i in B: dp[i] = True elif i in A: dp[i] = False else: if i < K: dp[i] = dp[i-1] if i >= K: if dp[i-K] == True or dp[i-1] == True: dp[i] = True else: dp[i] = dp[i-1] #print(A) #print(B) #"print(dp) if dp[N] == True or dp[N-K] == True: print("Yes") else: print("No")