結果

問題 No.689 E869120 and Constructing Array 3
ユーザー tktk_snsntktk_snsn
提出日時 2020-12-09 23:37:57
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,005 bytes
コンパイル時間 88 ms
コンパイル使用メモリ 11,944 KB
実行使用メモリ 10,332 KB
最終ジャッジ日時 2023-10-19 09:56:30
合計ジャッジ時間 3,317 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,316 KB
testcase_01 AC 31 ms
10,320 KB
testcase_02 AC 30 ms
10,320 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 31 ms
10,328 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 30 ms
10,328 KB
testcase_11 WA -
testcase_12 AC 31 ms
10,332 KB
testcase_13 AC 30 ms
10,316 KB
testcase_14 AC 30 ms
10,316 KB
testcase_15 AC 30 ms
10,284 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main(K):
    if K == 0:
        print(1, 10, sep="\n")
        return
    elif K == 1:
        print(2, *[1, 1], sep="\n")
        return

    ok = False
    for i in range(1, int(K ** 0.5 + 0.5) + 1):
        if K % i == 0 and (i + K // i) <= 250:
            ok = True
            two, three = i, K // i
            break

    if ok:
        print(two + three)
        A = [2] * two + [3] * three
        print(*A)
        return

    one = 2
    while True:
        x = one * (one - 1) // 2
        ok = False
        if x > K:
            break
        tmp = K - x
        for i in range(1, int(tmp ** 0.5 + 0.5) + 1):
            if tmp % i == 0 and (one + i + tmp // i) <= 250:
                ok = True
                two, three = i, K // i
                break
        if ok:
            break
        one += 1

    if ok:
        print(one + two + three)
        A = [1] * one + [2] * two + [3] * three
        print(*A)
        return

    print(None)
    return


K = int(input())
main(K)
0