結果

問題 No.1242 高橋君とすごろく
ユーザー KudeKude
提出日時 2020-10-02 22:00:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 73 ms / 2,000 ms
コード長 659 bytes
コンパイル時間 248 ms
コンパイル使用メモリ 87,300 KB
実行使用メモリ 76,028 KB
最終ジャッジ日時 2023-09-27 08:39:36
合計ジャッジ時間 3,209 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
71,356 KB
testcase_01 AC 66 ms
71,528 KB
testcase_02 AC 63 ms
71,324 KB
testcase_03 AC 65 ms
71,384 KB
testcase_04 AC 63 ms
71,256 KB
testcase_05 AC 62 ms
71,376 KB
testcase_06 AC 63 ms
71,416 KB
testcase_07 AC 62 ms
71,420 KB
testcase_08 AC 64 ms
71,144 KB
testcase_09 AC 62 ms
71,256 KB
testcase_10 AC 69 ms
75,928 KB
testcase_11 AC 73 ms
75,816 KB
testcase_12 AC 69 ms
75,668 KB
testcase_13 AC 70 ms
75,688 KB
testcase_14 AC 68 ms
75,804 KB
testcase_15 AC 72 ms
76,028 KB
testcase_16 AC 68 ms
75,916 KB
testcase_17 AC 69 ms
75,804 KB
testcase_18 AC 67 ms
75,928 KB
testcase_19 AC 70 ms
75,680 KB
testcase_20 AC 68 ms
75,844 KB
testcase_21 AC 67 ms
75,932 KB
testcase_22 AC 64 ms
71,452 KB
testcase_23 AC 63 ms
71,452 KB
testcase_24 AC 63 ms
71,448 KB
testcase_25 AC 68 ms
75,852 KB
testcase_26 AC 63 ms
71,672 KB
testcase_27 AC 63 ms
71,444 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k = map(int, input().split())
a = list(map(int, input().split()))
d = []
pre = n + 1000
for ai in reversed(a):
    if ai + 100 < pre:
        now = []
        d.append(now)
    now.append(ai-1)
    pre = ai
for di in d:
    mx = di[0]
    mn = di[-1]
    geta = min(mn, 100)
    l = mx - mn + 1 + geta
    dp = [0] * l + [0] * 10
    for ai in di:
        dp[ai - mn + geta] = 1
    for i in range(l - 1, -1, -1):
        if (
            dp[i+1] == dp[i+6] == 1 or
            dp[i+2] == dp[i+5] == 1 or
            dp[i+3] == dp[i+4] == 1
        ):
            dp[i] = 1
    #print(dp)
    if dp[0] == 1:
        print('No')
        exit(0)
print('Yes')
0