結果

問題 No.2402 Dirty Stairs and Shoes
ユーザー mattu34mattu34
提出日時 2023-09-08 00:52:17
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 914 bytes
コンパイル時間 598 ms
コンパイル使用メモリ 87,096 KB
実行使用メモリ 848,376 KB
最終ジャッジ日時 2023-09-08 00:52:25
合計ジャッジ時間 7,100 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 96 ms
71,580 KB
testcase_01 AC 90 ms
71,444 KB
testcase_02 AC 89 ms
71,904 KB
testcase_03 AC 158 ms
95,784 KB
testcase_04 AC 120 ms
77,972 KB
testcase_05 AC 183 ms
106,680 KB
testcase_06 AC 136 ms
87,276 KB
testcase_07 AC 154 ms
78,752 KB
testcase_08 AC 248 ms
100,444 KB
testcase_09 AC 146 ms
88,748 KB
testcase_10 AC 303 ms
96,380 KB
testcase_11 AC 137 ms
87,432 KB
testcase_12 AC 126 ms
78,796 KB
testcase_13 AC 961 ms
508,108 KB
testcase_14 MLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *
import heapq
import bisect
import itertools


INF = float("inf")
MOD = 998244353
mod = 998244353

N, K = map(int, input().split())
M = int(input())
A = list(map(int, input().split()))
state = [0] * (N + 1)
for a in A:
    state[a] = -1
M = int(input())
B = list(map(int, input().split()))
for b in B:
    state[b] = 1

dp = [[0] * 2 for _ in range(N + 1)]
dp[0][0] = 1
for i in range(N):
    for j in range(2):
        if state[i + 1] == 0:
            dp[i + 1][j] += dp[i][j]
        elif state[i + 1] == 1:
            dp[i + 1][0] += dp[i][j]
        else:
            dp[i + 1][1] += dp[i][j]

        if i + K <= N:
            if state[i + K] == 0:
                dp[i + K][j] += dp[i][j]
            elif state[i + K] == 1:
                dp[i + K][0] += dp[i][j]
            else:
                dp[i + K][1] += dp[i][j]
if dp[N][0] > 0:
    print("Yes")
else:
    print("No")
0