結果

問題 No.1242 高橋君とすごろく
ユーザー nagissnagiss
提出日時 2020-10-02 21:57:58
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 599 bytes
コンパイル時間 87 ms
コンパイル使用メモリ 10,944 KB
実行使用メモリ 15,324 KB
最終ジャッジ日時 2023-09-24 12:14:23
合計ジャッジ時間 4,264 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,052 KB
testcase_01 AC 19 ms
8,220 KB
testcase_02 AC 17 ms
8,364 KB
testcase_03 AC 17 ms
8,196 KB
testcase_04 AC 17 ms
8,192 KB
testcase_05 AC 18 ms
8,180 KB
testcase_06 AC 18 ms
8,256 KB
testcase_07 AC 17 ms
8,368 KB
testcase_08 AC 17 ms
8,020 KB
testcase_09 AC 17 ms
8,348 KB
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
権限があれば一括ダウンロードができます

ソースコード

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]]
st = set(q)
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]:
            a3 = ((a2+a)//2)+4
            if a < a3 and a3 not in st:
                p.append(a3)
                st.add(a3)
    for a2 in p:
        heappush(q, a2)
    cl.append(a)
if q:
    print("No")
else:
    print("Yes")
0