結果

問題 No.2608 Divide into two
ユーザー MitarushiMitarushi
提出日時 2022-08-26 19:02:02
言語 Nim
(2.0.2)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 373 bytes
コンパイル時間 2,813 ms
コンパイル使用メモリ 65,600 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-01-07 15:37:04
合計ジャッジ時間 3,248 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

import strutils

proc solve() =
    let n = stdin.readLine.parseBiggestInt
    if n * (n + 1) mod 4 != 0:
        echo -1
        return
    var s = n * (n + 1) div 4
    var result = '0'.repeat(n)
    for i in countdown(n, 1):
        if i <= s:
            result[i-1] = '1'
            s -= i
    echo result

let t = stdin.readLine.parseInt
for _ in 0..<t:
    solve()
0