結果
| 問題 | No.927 Second Permutation |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-11-22 21:44:58 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 343 bytes |
| 記録 | |
| コンパイル時間 | 91 ms |
| コンパイル使用メモリ | 12,416 KB |
| 実行使用メモリ | 12,032 KB |
| 最終ジャッジ日時 | 2024-10-11 03:12:00 |
| 合計ジャッジ時間 | 2,217 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 24 WA * 3 |
ソースコード
#!/usr/bin/env python3
def solve(x):
if len(x) == 1 or (len(x) == 2 and '0' in x) or (x.count(x[0]) == len(x)):
return -1
y = sorted(x, reverse=True)
for i in reversed(range(len(y) - 1)):
if y[i] != y[i + 1]:
y[i], y[i + 1] = y[i + 1], y[i]
break
return ''.join(y)
print(solve(input()))