結果

問題 No.927 Second Permutation
コンテスト
ユーザー takakin
提出日時 2020-04-24 01:39:18
言語 Python3
(3.14.7 + numpy 2.5.2 + scipy 1.18.0 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
WA  
実行時間 -
コード長 379 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 56 ms
コンパイル使用メモリ 15,104 KB
実行使用メモリ 11,904 KB
最終ジャッジ日時 2026-09-16 12:22:58
合計ジャッジ時間 2,695 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import sys
input=lambda: sys.stdin.readline().rstrip()
import collections
X=collections.Counter(list(input()))
if len(X.keys())==1:
  print(-1)
elif len(X.keys())==2 and X["0"]>0:
  print(-1)
else:
  ans=""
  A=sorted(list(X.keys()))
  ans+=str(A[0])*(X[A[0]]-1)+str(A[1])+str(A[0])+str(A[1])*(X[A[1]]-1)
  for i in range(2,len(A)):
    ans+=str(A[i])*X[A[i]]
  print(ans[::-1])
0