結果

問題 No.927 Second Permutation
ユーザー V.ll
提出日時 2020-01-04 19:39:12
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 87 ms / 2,000 ms
コード長 194 bytes
コンパイル時間 245 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 18,208 KB
最終ジャッジ日時 2024-11-22 21:22:27
合計ジャッジ時間 2,966 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

a=sorted(map(int,input()))
if a[-2]==0:print(-1)
elif a[0]==a[-1]:print(-1)
else:
 k=1
 while a[0]==a[k]:k+=1
 a[k]+=a[k-1];a[k-1]=a[k]-a[k-1];a[k]-=a[k-1];print(''.join(list(map(str,a))[::-1]))
0