結果

問題 No.688 E869120 and Constructing Array 2
ユーザー rlangevinrlangevin
提出日時 2023-01-13 12:30:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 72 ms / 1,000 ms
コード長 373 bytes
コンパイル時間 332 ms
コンパイル使用メモリ 87,056 KB
実行使用メモリ 71,516 KB
最終ジャッジ日時 2023-08-25 20:04:25
合計ジャッジ時間 2,297 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,308 KB
testcase_01 AC 69 ms
71,272 KB
testcase_02 AC 70 ms
71,120 KB
testcase_03 AC 72 ms
71,316 KB
testcase_04 AC 68 ms
71,260 KB
testcase_05 AC 69 ms
71,336 KB
testcase_06 AC 68 ms
71,344 KB
testcase_07 AC 69 ms
71,232 KB
testcase_08 AC 69 ms
71,516 KB
testcase_09 AC 69 ms
71,352 KB
testcase_10 AC 69 ms
71,340 KB
testcase_11 AC 69 ms
71,396 KB
testcase_12 AC 69 ms
71,384 KB
権限があれば一括ダウンロードができます

ソースコード

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