結果

問題 No.2608 Divide into two
ユーザー hir355hir355
提出日時 2024-01-19 21:41:45
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 48 ms / 1,000 ms
コード長 651 bytes
コンパイル時間 216 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 61,956 KB
最終ジャッジ日時 2024-01-19 21:41:46
合計ジャッジ時間 929 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,332 KB
testcase_01 AC 48 ms
61,956 KB
testcase_02 AC 39 ms
53,332 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

t = int(input())
for _ in range(t):
    n = int(input())
    if n % 4 == 0:
        print('0110' * (n // 4))
    elif n % 4 == 3:
        ans = ['0', '1', '1', '0'] * ((n + 1) // 4)
        ans.pop()
        if ans[(n + 1) // 2 - 1] == '0':
            ans[-3] = '1'
            ans[-2] = '0'
            ans[-1] = '0'
            ans[(n + 1) // 2 - 1] = '1'
        else:
            ans[(n + 1) // 2 - 1] = '0'
        # a, b = 0, 0
        # for i in range(n):
        #     if ans[i] == '0':
        #         a += i + 1
        #     else:
        #         b += i + 1
        # print(a, b)
        print(*ans, sep='')
    else:
        print(-1)
0