結果
問題 | No.927 Second Permutation |
ユーザー |
![]() |
提出日時 | 2020-04-13 22:39:19 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 112 ms / 2,000 ms |
コード長 | 347 bytes |
コンパイル時間 | 263 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 89,088 KB |
最終ジャッジ日時 | 2024-09-25 11:22:06 |
合計ジャッジ時間 | 3,604 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
ソースコード
x=list(input()) if len(set(x))==1: # 999 print(-1) exit() flg=True for i in range(1,len(x)): if x[i] != "0": flg=False if flg: print(-1) exit() x.sort() now=0 for i in range(1,len(x)): if x[now] != x[i]: x[now],x[i] = x[i],x[now] break else: now=i x=list(reversed(x)) print(*x,sep="")