結果
| 問題 |
No.2402 Dirty Stairs and Shoes
|
| コンテスト | |
| ユーザー |
irohasu19_
|
| 提出日時 | 2023-08-09 03:59:50 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 167 ms / 2,000 ms |
| コード長 | 734 bytes |
| コンパイル時間 | 460 ms |
| コンパイル使用メモリ | 82,504 KB |
| 実行使用メモリ | 97,756 KB |
| 最終ジャッジ日時 | 2024-12-20 02:50:54 |
| 合計ジャッジ時間 | 3,763 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 32 |
ソースコード
n, k = map(int, input().split())
m_1 = int(input())
A = list(map(int, input().split()))
m_2 = int(input())
B = list(map(int, input().split()))
dp = [[0] * 2 for _ in range(n+1)]
dp[0][0] = True; dp[0][1] = False;
for a in A:
dp[a][0] = False; dp[a][1] = True
for b in B:
dp[b][0] = True; dp[b][1] = False;
for i in range(n+1):
if type(dp[i][0]) == bool:
continue
else:
if i-k >= 0:
if dp[i-k][0]==True or dp[i-1][0]==True:
dp[i][0] = True; dp[i][1] = False
else:
dp[i][0] = False; dp[i][1] = True
else:
if dp[i-1][0] == True:
dp[i][0] = True; dp[i][1] = False
else:
dp[i][0] = False; dp[i][1] = True
if(dp[n][0]==True):
print("Yes")
else:
print("No")
irohasu19_