結果

問題 No.1242 高橋君とすごろく
ユーザー titiatitia
提出日時 2020-10-02 21:30:15
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 64 ms / 2,000 ms
コード長 580 bytes
コンパイル時間 569 ms
コンパイル使用メモリ 10,888 KB
実行使用メモリ 8,316 KB
最終ジャッジ日時 2023-09-27 08:36:06
合計ジャッジ時間 2,013 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
7,816 KB
testcase_01 AC 13 ms
8,140 KB
testcase_02 AC 15 ms
7,904 KB
testcase_03 AC 15 ms
8,244 KB
testcase_04 AC 15 ms
8,180 KB
testcase_05 AC 15 ms
7,856 KB
testcase_06 AC 13 ms
8,132 KB
testcase_07 AC 14 ms
8,096 KB
testcase_08 AC 13 ms
7,844 KB
testcase_09 AC 13 ms
8,132 KB
testcase_10 AC 38 ms
8,144 KB
testcase_11 AC 58 ms
7,848 KB
testcase_12 AC 38 ms
8,124 KB
testcase_13 AC 54 ms
7,896 KB
testcase_14 AC 26 ms
8,124 KB
testcase_15 AC 51 ms
7,804 KB
testcase_16 AC 57 ms
7,852 KB
testcase_17 AC 56 ms
8,256 KB
testcase_18 AC 57 ms
8,148 KB
testcase_19 AC 55 ms
8,196 KB
testcase_20 AC 56 ms
7,836 KB
testcase_21 AC 54 ms
8,236 KB
testcase_22 AC 25 ms
7,840 KB
testcase_23 AC 26 ms
7,816 KB
testcase_24 AC 58 ms
7,840 KB
testcase_25 AC 64 ms
7,852 KB
testcase_26 AC 15 ms
8,316 KB
testcase_27 AC 14 ms
8,096 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N,K=map(int,input().split())
A=list(map(int,input().split()))

NG=set(A)

for a in A[::-1]:
    for j in range(a,a-1001,-1):
        if j<1:
            continue
        
        if (j+1 in NG and j+6 in NG) or (j+2 in NG and j+5 in NG) or (j+3 in NG and j+4 in NG):
            NG.add(j)

        if 1 in NG:
            print("No")
            sys.exit()

        if j in NG and j+1 in NG and j+2 in NG and j+3 in NG and j+4 in NG and j+5 in NG and j+6 in NG:
            print("No")
            sys.exit()
        
else:
    print("Yes")
0