結果
| 問題 | No.927 Second Permutation |
| コンテスト | |
| ユーザー |
maspy
|
| 提出日時 | 2020-01-24 01:33:44 |
| 言語 | Python3 (3.14.7 + numpy 2.5.2 + scipy 1.18.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 108 ms / 2,000 ms |
| + 408µs | |
| コード長 | 432 bytes |
| 記録 | |
| コンパイル時間 | 292 ms |
| コンパイル使用メモリ | 21,412 KB |
| 実行使用メモリ | 16,632 KB |
| 最終ジャッジ日時 | 2026-08-25 22:00:29 |
| 合計ジャッジ時間 | 5,406 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
ソースコード
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
X = read().decode().rstrip()
X = sorted(X, reverse = True)
if X[0] == X[-1]:
print(-1)
exit()
if sum(x > '0' for x in X) == 1:
print(-1)
exit()
for i in range(len(X)-2,-1,-1):
if X[i] == X[i+1]:
continue
X[i], X[i+1] = X[i+1], X[i]
break
answer = ''.join(X)
print(answer)
maspy