結果

問題 No.927 Second Permutation
コンテスト
ユーザー komkompi
提出日時 2019-11-25 22:00:34
言語 Python3
(3.15.2 + numpy 2.5.4 + scipy 1.18.1 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 283 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 56 ms
コンパイル使用メモリ 15,232 KB
実行使用メモリ 12,836 KB
最終ジャッジ日時 2026-10-12 04:40:15
合計ジャッジ時間 2,436 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

# coding: utf-8
# Your code here!
X=list(input())

X.sort(reverse=True)
temp=X[:]

i=-1
while True:
    if X[i]=="0" and X[i-1]=="0":
        i-=1
    else:
        break

#print(i)
X[i-1],X[i]=X[i],X[i-1]

#print(X)
if temp==X or X[0]=="0":
    print(-1)
else:
    print("".join(X))
0