結果

問題 No.1242 高橋君とすごろく
ユーザー daikisuyamadaikisuyama
提出日時 2020-10-03 12:20:45
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 75 ms / 2,000 ms
コード長 641 bytes
コンパイル時間 277 ms
コンパイル使用メモリ 87,080 KB
実行使用メモリ 71,500 KB
最終ジャッジ日時 2023-09-27 08:47:51
合計ジャッジ時間 3,634 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,292 KB
testcase_01 AC 74 ms
71,292 KB
testcase_02 AC 73 ms
71,360 KB
testcase_03 AC 73 ms
71,420 KB
testcase_04 AC 73 ms
71,292 KB
testcase_05 AC 72 ms
71,260 KB
testcase_06 AC 75 ms
71,376 KB
testcase_07 AC 73 ms
71,248 KB
testcase_08 AC 74 ms
71,424 KB
testcase_09 AC 75 ms
71,404 KB
testcase_10 AC 73 ms
71,288 KB
testcase_11 AC 73 ms
71,288 KB
testcase_12 AC 73 ms
71,452 KB
testcase_13 AC 74 ms
71,044 KB
testcase_14 AC 73 ms
71,372 KB
testcase_15 AC 72 ms
71,404 KB
testcase_16 AC 71 ms
71,332 KB
testcase_17 AC 71 ms
71,092 KB
testcase_18 AC 72 ms
71,464 KB
testcase_19 AC 73 ms
71,304 KB
testcase_20 AC 73 ms
71,340 KB
testcase_21 AC 73 ms
71,332 KB
testcase_22 AC 75 ms
71,500 KB
testcase_23 AC 72 ms
71,428 KB
testcase_24 AC 75 ms
71,324 KB
testcase_25 AC 73 ms
71,404 KB
testcase_26 AC 73 ms
71,496 KB
testcase_27 AC 75 ms
71,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k=map(int,input().split())
a=list(map(int,input().split()))
b=set(a)
for i in range(k-1,-1,-1):
    if a[i]<=9:
        break
    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()
for j in range(9,0,-1):
    if j in b:
        if j+1 in b:
            if j-3>=1:
                b.add(j-3)
        if j+3 in b:
            if j-2>=1:
                b.add(j-2)
        if j+5 in b:
            if j-1>=1:
                b.add(j-1)
if 1 in b:
    print("No")
    exit()
print("Yes")
0