結果

問題 No.688 E869120 and Constructing Array 2
ユーザー rlangevin
提出日時 2023-01-13 12:30:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 47 ms / 1,000 ms
コード長 373 bytes
コンパイル時間 186 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 52,224 KB
最終ジャッジ日時 2024-12-24 06:08:02
合計ジャッジ時間 1,727 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

K = int(input())
ans = []
if K == 0:
    ans = [0]
two = [1] * 31
for i in range(1, 31):
    two[i] = two[i - 1] * 2

for i in range(2, 31):
    q, r = divmod(K, (i * (i - 1)//2))
    if r:
        continue
    if q not in two:
        continue
    ind = two.index(q)
    if ind + i > 30:
        continue
    ans = [0] * ind + [1] * i
    break
print(len(ans))
print(*ans)
0