結果

問題 No.688 E869120 and Constructing Array 2
ユーザー tktk_snsntktk_snsn
提出日時 2020-12-09 23:12:12
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 33 ms / 1,000 ms
コード長 362 bytes
コンパイル時間 151 ms
コンパイル使用メモリ 12,012 KB
実行使用メモリ 10,168 KB
最終ジャッジ日時 2023-10-19 09:33:06
合計ジャッジ時間 1,468 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

K = int(input())
if K == 0:
    print(1)
    print(0)
    exit()

d = {1 << i: i for i in range(60)}

one = 2
while one < 10 ** 5:
    X = one * (one - 1) // 2
    ok = False
    if K % X == 0:
        if K // X in d:
            zero = d[K // X]
            ok = True
    if ok:
        break
    one += 1

A = [0] * zero + [1] * one
print(one + zero)
print(*A)
0