結果

問題 No.688 E869120 and Constructing Array 2
ユーザー tcltk
提出日時 2021-11-20 03:17:59
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 124 ms / 1,000 ms
コード長 655 bytes
コンパイル時間 716 ms
コンパイル使用メモリ 82,392 KB
実行使用メモリ 87,344 KB
最終ジャッジ日時 2025-01-02 10:01:40
合計ジャッジ時間 2,974 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
# from typing import *

import sys
import io
import math
import collections
import decimal
import itertools
import bisect
import heapq


def input():
    return sys.stdin.readline()[:-1]


# sys.setrecursionlimit(1000000)

# _INPUT = """# paste here...
# """
# sys.stdin = io.StringIO(_INPUT)

INF = 10**10

def solve(K):
    if K == 0:
        return [0]

    for N in range(2, 31):
        for n1 in range(2, N+1):
            n0 = N - n1
            v = (n1 * (n1-1) //2) * (2 ** n0)
            if v == K:
                return [1] * n1 + [0] * n0
    return [-1]



K = int(input())
ans = solve(K)
print(len(ans))
print(*ans)
0