結果

問題 No.927 Second Permutation
ユーザー liny_tailliny_tail
提出日時 2023-01-03 17:59:44
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 35 ms / 2,000 ms
コード長 184 bytes
コンパイル時間 292 ms
コンパイル使用メモリ 10,476 KB
実行使用メモリ 9,964 KB
最終ジャッジ日時 2023-08-18 00:44:00
合計ジャッジ時間 2,066 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,848 KB
testcase_01 AC 15 ms
7,828 KB
testcase_02 AC 15 ms
7,796 KB
testcase_03 AC 15 ms
7,768 KB
testcase_04 AC 15 ms
7,828 KB
testcase_05 AC 15 ms
7,888 KB
testcase_06 AC 16 ms
7,828 KB
testcase_07 AC 16 ms
7,952 KB
testcase_08 AC 22 ms
8,616 KB
testcase_09 AC 16 ms
7,892 KB
testcase_10 AC 27 ms
9,140 KB
testcase_11 AC 33 ms
9,832 KB
testcase_12 AC 23 ms
8,724 KB
testcase_13 AC 16 ms
8,068 KB
testcase_14 AC 27 ms
9,108 KB
testcase_15 AC 23 ms
8,832 KB
testcase_16 AC 35 ms
9,920 KB
testcase_17 AC 35 ms
9,952 KB
testcase_18 AC 35 ms
9,892 KB
testcase_19 AC 35 ms
9,948 KB
testcase_20 AC 35 ms
9,964 KB
testcase_21 AC 35 ms
9,952 KB
testcase_22 AC 35 ms
9,952 KB
testcase_23 AC 35 ms
9,924 KB
testcase_24 AC 21 ms
9,640 KB
testcase_25 AC 19 ms
8,880 KB
testcase_26 AC 18 ms
8,584 KB
testcase_27 AC 17 ms
8,364 KB
testcase_28 AC 21 ms
9,352 KB
testcase_29 AC 20 ms
9,124 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

X = input().strip()

X = sorted(list(X), reverse=True)

pos = X.index(min(X))

X[pos-1], X[pos] = X[pos], X[pos-1]

if X[0] == '0' or pos == 0:
  print('-1')
else:
  print(''.join(X))
0