結果

問題 No.688 E869120 and Constructing Array 2
ユーザー brthyyjpbrthyyjp
提出日時 2020-11-12 22:45:20
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 453 bytes
コンパイル時間 702 ms
コンパイル使用メモリ 87,092 KB
実行使用メモリ 71,748 KB
最終ジャッジ日時 2023-09-30 01:51:56
合計ジャッジ時間 2,600 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 74 ms
71,300 KB
testcase_03 AC 75 ms
71,508 KB
testcase_04 AC 76 ms
71,588 KB
testcase_05 AC 75 ms
71,364 KB
testcase_06 AC 74 ms
71,324 KB
testcase_07 WA -
testcase_08 AC 75 ms
71,488 KB
testcase_09 AC 74 ms
71,340 KB
testcase_10 AC 75 ms
70,964 KB
testcase_11 AC 75 ms
71,428 KB
testcase_12 AC 74 ms
71,240 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

if k == 1:
    print(2)
    print(1, 1)
    exit()

if k == 2:
    print(3)
    print(1, 1, 0)
    exit()

import math
for i in range(2, int(math.sqrt(k))+1):
    t = i*(i-1)
    if (2*k)%t != 0:
        continue
    p = (2*k)//t
    c = 0
    while p%2 == 0:
        c += 1
        p //= 2
    if p != 1:
        continue
    print(c+i)
    ans = [0]*c+[1]*i
    print(*ans)
    exit()
0