結果
| 問題 |
No.927 Second Permutation
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-03-21 19:14:56 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 50 ms / 2,000 ms |
| コード長 | 260 bytes |
| コンパイル時間 | 537 ms |
| コンパイル使用メモリ | 12,416 KB |
| 実行使用メモリ | 11,904 KB |
| 最終ジャッジ日時 | 2024-10-09 09:15:23 |
| 合計ジャッジ時間 | 2,577 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
ソースコード
X = list(input())
n = len(X)
X.sort(reverse=True)
for i in range(n - 2, -1, -1):
if X[i] != X[i + 1]:
if i > 0 or (i == 0 and X[i + 1] != '0'):
X[i], X[i + 1] = X[i + 1], X[i]
print(''.join(X))
exit()
print(-1)