結果

問題 No.1743 Permutation Code
ユーザー V.ll
提出日時 2022-10-29 02:39:05
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 705 bytes
コンパイル時間 73 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 21,248 KB
最終ジャッジ日時 2024-07-06 04:57:13
合計ジャッジ時間 10,506 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 5 TLE * 1 -- * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

a=input()
b=1
c=0
while c+len(bin(b))-2<len(a):
    c+=len(bin(b))-2
    b+=1
c=len(bin(b))-2
r=[0,0]
s=set()
while 1:
    r[-1]+=1
    if r[-1]>len(a):
        del r[-1]
        s-={int(a[r[-2]:r[-1]],2)}
        continue
    if a[r[-1]:r[-1]+1]=='0':
        continue
    b=int(a[r[-2]:r[-1]],2)
    if b in s:#既出:次へ
        continue
    if r[-1]-r[-2]>c:
        del r[-1]
        s-={int(a[r[-2]:r[-1]],2)}
        continue
    if r[-1]==len(a):
        if s|{b}=={*range(1,len(s)+2)}:
            print(*[int(a[r[i]:r[i+1]],2)for i in range(len(r)-1)])
            break
        else:
            del r[-1]
            s-={int(a[r[-2]:r[-1]],2)}
            continue
    s|={b}
    r+=[r[-1]]
0