結果

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

ソースコード

diff #

a=input()
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]>5:
        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