結果

問題 No.1242 高橋君とすごろく
ユーザー kimiyukikimiyuki
提出日時 2020-10-02 21:58:51
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 36 ms / 2,000 ms
コード長 986 bytes
コンパイル時間 97 ms
コンパイル使用メモリ 10,952 KB
実行使用メモリ 9,880 KB
最終ジャッジ日時 2023-09-27 08:38:47
合計ジャッジ時間 2,291 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
9,736 KB
testcase_01 AC 32 ms
9,784 KB
testcase_02 AC 32 ms
9,724 KB
testcase_03 AC 32 ms
9,792 KB
testcase_04 AC 32 ms
9,736 KB
testcase_05 AC 31 ms
9,708 KB
testcase_06 AC 32 ms
9,800 KB
testcase_07 AC 32 ms
9,760 KB
testcase_08 AC 32 ms
9,748 KB
testcase_09 AC 32 ms
9,724 KB
testcase_10 AC 33 ms
9,816 KB
testcase_11 AC 34 ms
9,752 KB
testcase_12 AC 34 ms
9,748 KB
testcase_13 AC 34 ms
9,828 KB
testcase_14 AC 33 ms
9,872 KB
testcase_15 AC 34 ms
9,816 KB
testcase_16 AC 35 ms
9,760 KB
testcase_17 AC 35 ms
9,768 KB
testcase_18 AC 35 ms
9,728 KB
testcase_19 AC 35 ms
9,868 KB
testcase_20 AC 34 ms
9,804 KB
testcase_21 AC 35 ms
9,732 KB
testcase_22 AC 33 ms
9,796 KB
testcase_23 AC 34 ms
9,828 KB
testcase_24 AC 36 ms
9,752 KB
testcase_25 AC 35 ms
9,752 KB
testcase_26 AC 33 ms
9,880 KB
testcase_27 AC 32 ms
9,712 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
from typing import *

def solve(n: int, k: int, a: List[int]) -> bool:
    b = set(a)
    for a_i in reversed(a):
        for i in reversed(range(max(1, a_i - 100), a_i + 1)):
            if ((i + 1) in b and (i + 6) in b) or ((i + 2) in b and (i + 5) in b) or ((i + 3) in b and (i + 4) in b):
                b.add(i)
            if (i + 1) in b and (i + 6) in b and (i + 2) in b and (i + 5) in b and (i + 3) in b and (i + 4) in b:
                return False
    return 1 not in b


YES = 'Yes'
NO = 'No'


# generated by online-judge-template-generator v4.7.1 (https://github.com/online-judge-tools/template-generator)
def main():
    import sys
    tokens = iter(sys.stdin.read().split())
    N = int(next(tokens))
    K = int(next(tokens))
    A = [None for _ in range(K)]
    for i in range(K):
        A[i] = int(next(tokens))
    assert next(tokens, None) is None
    a = solve(N, K, A)
    print(a and YES or NO)


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