結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,156 KB
testcase_01 AC 16 ms
8,212 KB
testcase_02 AC 18 ms
8,176 KB
testcase_03 AC 18 ms
8,208 KB
testcase_04 AC 19 ms
8,324 KB
testcase_05 AC 21 ms
8,296 KB
testcase_06 AC 17 ms
8,032 KB
testcase_07 AC 17 ms
8,352 KB
testcase_08 AC 16 ms
7,924 KB
testcase_09 AC 17 ms
8,044 KB
testcase_10 AC 20 ms
7,992 KB
testcase_11 AC 19 ms
8,004 KB
testcase_12 AC 19 ms
7,980 KB
testcase_13 AC 19 ms
8,000 KB
testcase_14 AC 18 ms
7,980 KB
testcase_15 AC 18 ms
8,008 KB
testcase_16 AC 19 ms
8,344 KB
testcase_17 AC 19 ms
8,332 KB
testcase_18 AC 18 ms
8,200 KB
testcase_19 AC 19 ms
8,364 KB
testcase_20 WA -
testcase_21 AC 20 ms
8,008 KB
testcase_22 AC 18 ms
8,008 KB
testcase_23 AC 18 ms
7,924 KB
testcase_24 AC 19 ms
8,040 KB
testcase_25 AC 18 ms
8,052 KB
testcase_26 AC 19 ms
8,040 KB
testcase_27 AC 17 ms
8,172 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]:
            a3 = ((a2+a)//2)+4
            if a < a3:
                p.append(a3)
    for a2 in p:
        heappush(q, a2)
    cl.append(a)
if q:
    print("No")
else:
    print("Yes")
0