結果
| 問題 |
No.873 バイナリ、ヤバいなり!w
|
| コンテスト | |
| ユーザー |
vwxyz
|
| 提出日時 | 2024-04-15 11:36:14 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 512 bytes |
| コンパイル時間 | 94 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 18,980 KB |
| 最終ジャッジ日時 | 2024-10-05 06:54:29 |
| 合計ジャッジ時間 | 6,678 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | TLE * 1 -- * 35 |
ソースコード
N=int(input())
inf=1<<30
dp=[inf]*(N+1)
dp[0]=0
for i in range(1,N+1):
for j in range(1,int(i**.5)+1):
dp[i]=min(dp[i],dp[i-j*j]+j)
lst=[[],[]]
i=N
while i:
for j in range(1,int(i**.5)+1):
if dp[i]==dp[i-j*j]+j:
i-=j*j
lst[j%2].append(j)
ans_lst=[]
lst[0].sort(reverse=True)
lst[1].sort()
for x in lst[1]:
for i in range(x):
ans_lst.append(i%2)
p=0
for x in lst[0]:
for i in range(x):
ans_lst.append((i+p)%2)
p^=1
print(*ans_lst,sep="")
vwxyz