結果
| 問題 | No.927 Second Permutation |
| コンテスト | |
| ユーザー |
akanaya
|
| 提出日時 | 2020-03-29 16:05:45 |
| 言語 | Python3 (3.15.2 + numpy 2.5.4 + scipy 1.18.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 25 ms / 2,000 ms |
| + 616µs | |
| コード長 | 504 bytes |
| 記録 | |
| コンパイル時間 | 53 ms |
| コンパイル使用メモリ | 15,104 KB |
| 実行使用メモリ | 12,160 KB |
| 最終ジャッジ日時 | 2026-10-12 05:01:16 |
| 合計ジャッジ時間 | 2,494 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
from collections import Counter
x = list(input().strip())
c = Counter(x)
if len(c.keys()) == 1:
print(-1)
elif c['0'] == len(x) - 1:
print(-1)
else:
v = sorted(c.keys())[0]
c[v] -= 1
e = sorted(c.keys(), reverse=True)
for i in range(len(e)):
t = str(e[i])
if i != len(e) - 2:
print(t * c[t], end='')
else:
print(t * (c[t] - 1), end='')
print(v, end='')
print(t, end='')
print()
akanaya