結果

問題 No.1242 高橋君とすごろく
ユーザー daikisuyamadaikisuyama
提出日時 2020-10-03 12:01:39
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 713 bytes
コンパイル時間 278 ms
コンパイル使用メモリ 87,040 KB
実行使用メモリ 71,620 KB
最終ジャッジ日時 2023-09-25 05:01:51
合計ジャッジ時間 3,551 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
71,420 KB
testcase_01 AC 69 ms
71,404 KB
testcase_02 AC 68 ms
71,324 KB
testcase_03 AC 69 ms
71,272 KB
testcase_04 AC 71 ms
71,496 KB
testcase_05 AC 67 ms
71,360 KB
testcase_06 AC 71 ms
71,328 KB
testcase_07 AC 69 ms
71,308 KB
testcase_08 AC 68 ms
71,268 KB
testcase_09 AC 69 ms
71,164 KB
testcase_10 AC 70 ms
71,340 KB
testcase_11 AC 69 ms
71,268 KB
testcase_12 AC 71 ms
71,376 KB
testcase_13 AC 70 ms
71,252 KB
testcase_14 AC 70 ms
71,372 KB
testcase_15 AC 72 ms
71,436 KB
testcase_16 AC 73 ms
71,384 KB
testcase_17 WA -
testcase_18 AC 69 ms
71,064 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 70 ms
71,212 KB
testcase_22 AC 70 ms
71,364 KB
testcase_23 AC 69 ms
71,296 KB
testcase_24 AC 70 ms
71,340 KB
testcase_25 AC 70 ms
71,484 KB
testcase_26 AC 74 ms
71,164 KB
testcase_27 AC 72 ms
71,116 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k=map(int,input().split())
a=list(map(int,input().split()))
b=set(a)
dp=[0]*8
for i in range(k-1,-1,-1):
    if a[i]<=8:
        if a[i]+1 in b:
            if a[i]-3>=1:
                dp[a[i]-4]=1
                b.add(a[i]-3)
        if a[i]+3 in b:
            if a[i]-2>=1:
                dp[a[i]-3]=1
                b.add(a[i]-2)
        if a[i]+5 in b:
            if a[i]-1>=1:
                dp[a[i]-2]=1
                b.add(a[i]-1)
    else:
        if a[i]+1 in b:
            print("No")
            exit()
        if a[i]+3 in b:
            print("No")
            exit()
        if a[i]+5 in b:
            print("No")
            exit()
if dp[0]==1:
    print("No")
    exit()
print("Yes")
0