結果
問題 |
No.2402 Dirty Stairs and Shoes
|
ユーザー |
![]() |
提出日時 | 2023-10-08 21:09:11 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 704 bytes |
コンパイル時間 | 318 ms |
コンパイル使用メモリ | 82,296 KB |
実行使用メモリ | 110,592 KB |
最終ジャッジ日時 | 2024-07-26 18:12:52 |
合計ジャッジ時間 | 4,103 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 31 WA * 1 |
ソースコード
n,k = map(int,input().split()) m1 = int(input()) a = list(map(int,input().split())) m2 = int(input()) b = list(map(int,input().split())) from collections import * da = defaultdict(int) db = defaultdict(int) for i in a: da[i] += 1 for i in b: db[i] += 1 dp = [False]*(n+1) dp[0] = True for i in range(0,n): if dp[i] == True: if da[i] == 0: dp[i+1] = True if 0 <= i+k <= n: if da[i+k] == 0: dp[i+k] = True elif dp[i] == False: if db[i+1] == 1: dp[i+1] = True if 0 <= i+k <= n: if db[i+k] == 1: dp[i+k] = True if dp[-1]: print("Yes") else: print("No")