結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,080 KB
testcase_01 AC 17 ms
8,316 KB
testcase_02 AC 17 ms
8,316 KB
testcase_03 AC 16 ms
8,268 KB
testcase_04 AC 17 ms
8,236 KB
testcase_05 AC 17 ms
8,272 KB
testcase_06 AC 27 ms
8,376 KB
testcase_07 AC 29 ms
8,632 KB
testcase_08 AC 16 ms
7,956 KB
testcase_09 AC 28 ms
8,360 KB
testcase_10 AC 32 ms
8,688 KB
testcase_11 AC 19 ms
7,932 KB
testcase_12 AC 30 ms
8,796 KB
testcase_13 AC 19 ms
8,000 KB
testcase_14 AC 30 ms
8,680 KB
testcase_15 AC 19 ms
8,004 KB
testcase_16 AC 19 ms
8,160 KB
testcase_17 AC 19 ms
8,156 KB
testcase_18 AC 19 ms
8,192 KB
testcase_19 AC 19 ms
8,164 KB
testcase_20 WA -
testcase_21 AC 32 ms
8,296 KB
testcase_22 AC 19 ms
8,012 KB
testcase_23 AC 19 ms
8,020 KB
testcase_24 AC 19 ms
7,824 KB
testcase_25 AC 18 ms
8,016 KB
testcase_26 AC 31 ms
8,616 KB
testcase_27 AC 17 ms
8,204 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) <= 10000:
    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