結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,352 KB
testcase_01 AC 77 ms
71,328 KB
testcase_02 AC 76 ms
71,500 KB
testcase_03 WA -
testcase_04 AC 78 ms
71,248 KB
testcase_05 AC 77 ms
71,452 KB
testcase_06 AC 76 ms
71,328 KB
testcase_07 WA -
testcase_08 AC 78 ms
71,560 KB
testcase_09 AC 76 ms
71,380 KB
testcase_10 AC 74 ms
71,440 KB
testcase_11 AC 72 ms
71,172 KB
testcase_12 AC 72 ms
71,320 KB
testcase_13 AC 73 ms
71,344 KB
testcase_14 AC 74 ms
71,352 KB
testcase_15 AC 70 ms
71,064 KB
testcase_16 AC 73 ms
71,420 KB
testcase_17 WA -
testcase_18 AC 73 ms
71,204 KB
testcase_19 WA -
testcase_20 AC 75 ms
71,356 KB
testcase_21 WA -
testcase_22 AC 80 ms
71,340 KB
testcase_23 AC 75 ms
71,556 KB
testcase_24 AC 77 ms
71,408 KB
testcase_25 AC 76 ms
71,372 KB
testcase_26 AC 75 ms
71,556 KB
testcase_27 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k=map(int,input().split())
a=list(map(int,input().split()))
b=set(a)
dp=[0]*100
for i in range(k-1,-1,-1):
    if a[i]<=100:
        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