結果
問題 | No.2608 Divide into two |
ユーザー |
|
提出日時 | 2024-01-19 21:40:30 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 715 bytes |
コンパイル時間 | 169 ms |
コンパイル使用メモリ | 82,456 KB |
実行使用メモリ | 64,408 KB |
最終ジャッジ日時 | 2024-09-28 04:12:38 |
合計ジャッジ時間 | 1,403 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | WA * 2 |
ソースコード
T = int(input())for _ in range(T):N = int(input())if N * (N + 1) // 2 & 1:print(-1)continueans = [0] * Nif N % 2 == 0:for i in range(N // 2):ans[i] = i & 1for i in range(N // 2, N):ans[i] = (i + 1) & 1else:S = set(range(1, N + 1))A = list(range(1, N + 1))ss = set()n = 0nn = N * (N + 1) // 4while n < nn:if nn - n in S:ss.add(nn - n)S.discard(nn - n)breaks = A.pop()n += sS.discard(s)ss.add(s)for n in ss:ans[n - 1] = 1print(*ans)