結果
| 問題 |
No.2402 Dirty Stairs and Shoes
|
| コンテスト | |
| ユーザー |
やでな@競プロ
|
| 提出日時 | 2023-10-08 21:07:34 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 734 bytes |
| コンパイル時間 | 796 ms |
| コンパイル使用メモリ | 82,332 KB |
| 実行使用メモリ | 110,444 KB |
| 最終ジャッジ日時 | 2024-07-26 18:12:47 |
| 合計ジャッジ時間 | 5,286 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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 b:
dp[i] = 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")
やでな@競プロ