結果
問題 | 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 python3def solve(x):if len(x) == 1 or (len(x) == 2 and '0' in x) or (x.count(x[0]) == len(x)):return -1y = 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]breakreturn ''.join(y)print(solve(input()))