結果

問題 No.1242 高橋君とすごろく
ユーザー tamatotamato
提出日時 2020-10-02 22:16:49
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 1,054 bytes
コンパイル時間 280 ms
コンパイル使用メモリ 87,476 KB
実行使用メモリ 583,908 KB
最終ジャッジ日時 2023-09-24 21:06:35
合計ジャッジ時間 5,020 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
75,776 KB
testcase_01 AC 86 ms
71,624 KB
testcase_02 AC 83 ms
71,732 KB
testcase_03 AC 82 ms
71,580 KB
testcase_04 AC 82 ms
71,492 KB
testcase_05 AC 80 ms
71,520 KB
testcase_06 AC 81 ms
71,764 KB
testcase_07 AC 82 ms
71,644 KB
testcase_08 AC 81 ms
71,684 KB
testcase_09 AC 83 ms
71,908 KB
testcase_10 MLE -
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 #

mod = 1000000007
eps = 10**-9


def main():
    import sys
    from heapq import heappop, heappush, heapify
    input = sys.stdin.readline

    N, K = map(int, input().split())
    A = list(map(int, input().split()))

    B = [-a for a in A]
    S = {a for a in A}
    heapify(B)

    flg = 1
    b_prev = 10**20
    cnt = 0
    while B:
        b = -heappop(B)
        if b == b_prev - 1:
            cnt += 1
        else:
            cnt = 0
        if cnt == 6:
            flg = 0
            break
        if b == 1:
            flg = 0
            break
        elif b <= 0:
            break
        if b - 1 in S:
            if b-4 not in S:
                S.add(b - 4)
                heappush(B, -(b-4))
        if b - 3 in S:
            if b-5 not in S:
                S.add(b - 5)
                heappush(B, -(b-5))
        if b - 5 in S:
            if b-6 not in S:
                S.add(b - 6)
                heappush(B, -(b-6))
    if flg:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()
0