結果

問題 No.2608 Divide into two
ユーザー nikoro256nikoro256
提出日時 2024-01-19 21:45:13
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 631 bytes
コンパイル時間 174 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 68,768 KB
最終ジャッジ日時 2024-01-19 21:45:15
合計ジャッジ時間 1,057 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

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(''.join([str(a) for a in ans[::-1]]))
    else:
        print(-1)
0