結果

問題 No.927 Second Permutation
ユーザー トミー
提出日時 2024-12-16 21:16:43
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 223 bytes
コンパイル時間 494 ms
コンパイル使用メモリ 82,464 KB
実行使用メモリ 65,832 KB
最終ジャッジ日時 2024-12-16 21:16:47
合計ジャッジ時間 3,196 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10 WA * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

x=[_ for _ in input()]
x.sort(reverse=True)
if len(set(x))==1:
  print(-1)
  exit()
for i in range(len(x)-1,-1,-1):
  if x[i]!=x[-1]:
    x[i],x[-1]=x[-1],x[i]
    break
if x[0]=="0":
  print(-1)
  exit()
print("".join(x))
0