結果

問題 No.1242 高橋君とすごろく
ユーザー nagissnagiss
提出日時 2020-10-02 21:59:56
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,816 ms / 2,000 ms
コード長 636 bytes
コンパイル時間 81 ms
コンパイル使用メモリ 10,872 KB
実行使用メモリ 8,624 KB
最終ジャッジ日時 2023-09-27 08:39:29
合計ジャッジ時間 8,791 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
8,016 KB
testcase_01 AC 14 ms
8,404 KB
testcase_02 AC 15 ms
8,276 KB
testcase_03 AC 15 ms
8,236 KB
testcase_04 AC 15 ms
8,244 KB
testcase_05 AC 15 ms
8,276 KB
testcase_06 AC 16 ms
8,280 KB
testcase_07 AC 16 ms
8,288 KB
testcase_08 AC 15 ms
8,120 KB
testcase_09 AC 16 ms
8,352 KB
testcase_10 AC 1,816 ms
8,588 KB
testcase_11 AC 16 ms
8,116 KB
testcase_12 AC 1,816 ms
8,476 KB
testcase_13 AC 17 ms
8,080 KB
testcase_14 AC 1,815 ms
8,624 KB
testcase_15 AC 16 ms
8,196 KB
testcase_16 AC 16 ms
8,304 KB
testcase_17 AC 17 ms
8,228 KB
testcase_18 AC 17 ms
8,228 KB
testcase_19 AC 17 ms
8,288 KB
testcase_20 AC 17 ms
8,272 KB
testcase_21 AC 16 ms
8,276 KB
testcase_22 AC 17 ms
8,104 KB
testcase_23 AC 17 ms
8,076 KB
testcase_24 AC 16 ms
8,108 KB
testcase_25 AC 17 ms
8,072 KB
testcase_26 AC 1,816 ms
8,472 KB
testcase_27 AC 15 ms
8,260 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from time import time
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 = []
t0 = time()
while q and time()-t0 < 1.8:
    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