結果

問題 No.2608 Divide into two
ユーザー Kude
提出日時 2024-01-19 21:26:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 51 ms / 1,000 ms
コード長 309 bytes
コンパイル時間 174 ms
コンパイル使用メモリ 82,112 KB
実行使用メモリ 59,008 KB
最終ジャッジ日時 2024-09-28 03:56:41
合計ジャッジ時間 777 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

for _ in range(int(input())):
    n = int(input())
    sm = n * (n + 1) // 2
    if sm % 2:
        print(-1)
        continue
    tgt = sm // 2
    ans = ['0'] * n
    for x in range(n, 0, -1):
        if x <= tgt:
            ans[x - 1] = '1'
            tgt -= x
    assert tgt == 0
    print(''.join(ans))
0