結果
問題 | No.2608 Divide into two |
ユーザー |
![]() |
提出日時 | 2024-01-19 21:45:59 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 635 bytes |
コンパイル時間 | 292 ms |
コンパイル使用メモリ | 82,396 KB |
実行使用メモリ | 70,456 KB |
最終ジャッジ日時 | 2024-09-28 04:16:09 |
合計ジャッジ時間 | 1,084 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | WA * 2 |
ソースコード
dp=[[False]*10001 for _ in range(101)]dp[0][0]=Truefor i in range(100):for j in range(10001):if j+i+1<=100 and dp[i][j]:dp[i+1][j+i+1]=Truedp[i+1][j]=TrueT=int(input())for _ in range(T):N=int(input())su=(N+1)*N//2if su%2==1:print(-1)continueif dp[N][su//2]:pos=su//2ans=[]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-1print(''.join([str(a) for a in ans[::-1]]))else:print(-1)