結果
問題 | No.927 Second Permutation |
ユーザー |
|
提出日時 | 2020-02-10 18:57:23 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 50 ms / 2,000 ms |
コード長 | 265 bytes |
コンパイル時間 | 306 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 12,672 KB |
最終ジャッジ日時 | 2024-10-01 06:28:42 |
合計ジャッジ時間 | 2,364 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
ソースコード
ans = sorted(list(input()), reverse=True)x = len(ans) - ans.count(ans[-1])l = 0 if ans[-1] == '0' else -1r = x - 1for i in range(r, l, -1):if ans[i] > ans[x]:ans[i], ans[x] = ans[x], ans[i]breakelse:ans = ["-1"]print(''.join(ans))