結果
| 問題 | No.927 Second Permutation |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-12-30 00:26:55 |
| 言語 | Python3 (3.15.2 + numpy 2.5.4 + scipy 1.18.1 + ACL) |
| 結果 |
WA
不安定
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 451 bytes |
| 記録 | |
| コンパイル時間 | 54 ms |
| コンパイル使用メモリ | 14,976 KB |
| 実行使用メモリ | 12,724 KB |
| 最終ジャッジ日時 | 2026-10-12 04:42:35 |
| 合計ジャッジ時間 | 2,380 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 28 WA * 1 |
ソースコード
x = list(input())
x.sort(reverse=True)
y = sorted(x, reverse=True)
z_flag = False
las_ind = -1
if "0" in x:
while not z_flag:
if x[las_ind] == "0":
las_ind -= 1
else:
z_flag = True
x[las_ind], x[las_ind+1] = x[las_ind+1], x[las_ind]
if x[0] == "0":print(-1)
else:print("".join(x))
else:
y[-1], y[-2] = y[-2], y[-1]
if y[0] == "0" or x == y:
print(-1)
else:print("".join(y))