結果

問題 No.1242 高橋君とすごろく
ユーザー nagissnagiss
提出日時 2020-10-02 21:46:05
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 496 bytes
コンパイル時間 101 ms
コンパイル使用メモリ 10,916 KB
実行使用メモリ 8,316 KB
最終ジャッジ日時 2023-09-23 04:33:45
合計ジャッジ時間 1,917 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,940 KB
testcase_01 AC 16 ms
8,228 KB
testcase_02 AC 17 ms
8,204 KB
testcase_03 AC 17 ms
8,220 KB
testcase_04 AC 17 ms
8,200 KB
testcase_05 AC 16 ms
8,188 KB
testcase_06 AC 17 ms
7,944 KB
testcase_07 AC 17 ms
7,940 KB
testcase_08 AC 16 ms
7,992 KB
testcase_09 AC 17 ms
7,928 KB
testcase_10 AC 19 ms
7,944 KB
testcase_11 AC 18 ms
8,008 KB
testcase_12 AC 19 ms
7,984 KB
testcase_13 AC 19 ms
7,988 KB
testcase_14 AC 18 ms
8,008 KB
testcase_15 AC 18 ms
7,988 KB
testcase_16 AC 18 ms
8,316 KB
testcase_17 AC 19 ms
8,224 KB
testcase_18 AC 19 ms
8,148 KB
testcase_19 AC 19 ms
8,276 KB
testcase_20 WA -
testcase_21 AC 20 ms
7,980 KB
testcase_22 AC 18 ms
7,984 KB
testcase_23 AC 19 ms
8,004 KB
testcase_24 AC 18 ms
7,972 KB
testcase_25 AC 19 ms
8,112 KB
testcase_26 AC 18 ms
7,972 KB
testcase_27 AC 16 ms
8,192 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heappop, heappush
N, K = map(int, input().split())
A = list(map(int, input().split()))

q = [-a for a in A[::-1]]
cl = []
while 0 < len(q) <= 1000:
    a = heappop(q)
    if a == -1:
        print("No")
        exit()
    elif a > -1:
        print("Yes")
        exit()
    p = []
    for a2 in q + cl:
        if abs(a2-a) in [1, 3, 5]:
            p.append(((a2+a)//2)+4)
    for a2 in p:
        heappush(q, a2)
    cl.append(a)
if q:
    print("No")
else:
    print("Yes")
0