結果
問題 | No.2608 Divide into two |
ユーザー | lloyz |
提出日時 | 2024-01-21 18:45:03 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 43 ms / 1,000 ms |
コード長 | 489 bytes |
コンパイル時間 | 474 ms |
コンパイル使用メモリ | 81,700 KB |
実行使用メモリ | 62,092 KB |
最終ジャッジ日時 | 2024-01-21 18:45:07 |
合計ジャッジ時間 | 1,286 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 35 ms
53,460 KB |
testcase_01 | AC | 41 ms
59,576 KB |
testcase_02 | AC | 43 ms
62,092 KB |
ソースコード
for _ in range(int(input())): n = int(input()) sum_ = n * (n + 1) // 2 if sum_ % 2 == 1: print(-1) else: curr = sum_ // 2 ANS = [0 for _ in range(n)] idx = n - 1 while curr > 0: curr -= idx + 1 if curr <= 0: curr += idx + 1 ANS[curr - 1] = 1 curr = 0 else: ANS[idx] = 1 idx -= 1 print(''.join(map(str, ANS)))