結果
| 問題 | No.2608 Divide into two |
| コンテスト | |
| ユーザー |
nikoro256
|
| 提出日時 | 2024-01-19 21:43:27 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 605 bytes |
| 記録 | |
| コンパイル時間 | 252 ms |
| コンパイル使用メモリ | 81,920 KB |
| 実行使用メモリ | 67,200 KB |
| 最終ジャッジ日時 | 2024-09-28 04:14:31 |
| 合計ジャッジ時間 | 1,013 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | RE * 2 |
ソースコード
dp=[[False]*101 for _ in range(101)]
dp[0][0]=True
for i in range(100):
for j in range(101):
if j+i+1<=100 and dp[i][j]:
dp[i+1][j+i+1]=True
dp[i+1][j]=True
T=int(input())
for _ in range(T):
N=int(input())
su=(N+1)*N//2
if su%2==1:
print(-1)
continue
if dp[N][su//2]:
pos=su//2
ans=[]
for i in range(N-1,-1,-1):
if dp[i][pos]:
ans.append(0)
elif dp[i][pos-i-1]:
ans.append(1)
pos=pos-i-1
print(*ans[::-1])
else:
print(-1)
nikoro256