結果

問題 No.2402 Dirty Stairs and Shoes
ユーザー mattu34mattu34
提出日時 2023-09-08 00:54:40
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
MLE  
実行時間 -
コード長 914 bytes
コンパイル時間 992 ms
コンパイル使用メモリ 10,832 KB
実行使用メモリ 814,976 KB
最終ジャッジ日時 2023-09-08 00:54:49
合計ジャッジ時間 5,655 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,740 KB
testcase_01 AC 19 ms
8,600 KB
testcase_02 AC 19 ms
8,736 KB
testcase_03 AC 263 ms
23,112 KB
testcase_04 AC 45 ms
10,172 KB
testcase_05 AC 378 ms
32,748 KB
testcase_06 AC 111 ms
15,248 KB
testcase_07 AC 92 ms
11,896 KB
testcase_08 AC 142 ms
30,164 KB
testcase_09 AC 182 ms
18,000 KB
testcase_10 AC 292 ms
25,248 KB
testcase_11 AC 141 ms
15,900 KB
testcase_12 AC 66 ms
11,596 KB
testcase_13 AC 900 ms
473,500 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