結果
問題 |
No.927 Second Permutation
|
ユーザー |
![]() |
提出日時 | 2020-04-24 01:39:18 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 379 bytes |
コンパイル時間 | 89 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 11,776 KB |
最終ジャッジ日時 | 2024-10-14 10:25:09 |
合計ジャッジ時間 | 2,168 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 26 WA * 1 |
ソースコード
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])