結果

問題 No.1242 高橋君とすごろく
ユーザー NoneNone
提出日時 2021-09-28 15:29:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 112 ms / 2,000 ms
コード長 354 bytes
コンパイル時間 383 ms
コンパイル使用メモリ 87,132 KB
実行使用メモリ 84,288 KB
最終ジャッジ日時 2023-09-22 05:32:24
合計ジャッジ時間 5,657 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 100 ms
84,032 KB
testcase_01 AC 100 ms
83,960 KB
testcase_02 AC 100 ms
84,004 KB
testcase_03 AC 97 ms
83,984 KB
testcase_04 AC 100 ms
83,872 KB
testcase_05 AC 98 ms
83,964 KB
testcase_06 AC 104 ms
83,968 KB
testcase_07 AC 104 ms
83,932 KB
testcase_08 AC 98 ms
83,960 KB
testcase_09 AC 101 ms
83,912 KB
testcase_10 AC 109 ms
84,176 KB
testcase_11 AC 106 ms
84,228 KB
testcase_12 AC 109 ms
84,212 KB
testcase_13 AC 107 ms
84,288 KB
testcase_14 AC 105 ms
84,212 KB
testcase_15 AC 106 ms
84,272 KB
testcase_16 AC 109 ms
84,160 KB
testcase_17 AC 111 ms
83,968 KB
testcase_18 AC 108 ms
84,184 KB
testcase_19 AC 107 ms
84,160 KB
testcase_20 AC 112 ms
84,084 KB
testcase_21 AC 109 ms
84,184 KB
testcase_22 AC 106 ms
84,084 KB
testcase_23 AC 102 ms
83,972 KB
testcase_24 AC 111 ms
84,160 KB
testcase_25 AC 108 ms
84,052 KB
testcase_26 AC 108 ms
84,280 KB
testcase_27 AC 98 ms
83,848 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K=map(int, input().split())
A=list(map(int, input().split()))
S=set(A)
L=10**6
dp=[0]*(L+10)
for i in range(L)[::-1]:
    if i in S: dp[i]=1
    dp[i]|=dp[i+1]&dp[i+6]
    dp[i]|=dp[i+2]&dp[i+5]
    dp[i]|=dp[i+3]&dp[i+4]
for a in A:
    for b in A:
        if a>L and b>L and abs(a-b) in (1,3,5):
            dp[1]=1
print("Yes" if dp[1]==0 else "No")
0