結果
| 問題 |
No.2608 Divide into two
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-01-19 21:36:32 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 972 bytes |
| コンパイル時間 | 540 ms |
| コンパイル使用メモリ | 81,996 KB |
| 実行使用メモリ | 75,996 KB |
| 最終ジャッジ日時 | 2024-09-28 04:06:22 |
| 合計ジャッジ時間 | 1,278 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | WA * 2 |
ソースコード
T = int(input())
def calc(N):
S = N * (N + 1) / 2
return S
def greedy(N, S):
num = [i for i in range(1, N + 1)]
ans = []
s = []
for n in num:
s.append(n)
if sum(s) == S:
for i in range(1, N + 1):
if i in s:
ans.append(1)
else:
ans.append(0)
return ans
if sum(s) > S:
while s:
s = s[1:]
if sum(s) == S:
for i in range(1, N + 1):
if i in s:
ans.append(1)
else:
ans.append(0)
return ans
return -1
for _ in range(T):
N = int(input())
S = calc(N)
if S % 2 == 1:
print(-1)
continue
S //= 2
ans = greedy(N, S)
if ans == -1:
print(-1)
else:
print("".join(map(str, ans)))