結果

問題 No.927 Second Permutation
ユーザー nohakai3nohakai3
提出日時 2022-07-24 18:09:51
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 36 ms / 2,000 ms
コード長 258 bytes
コンパイル時間 580 ms
コンパイル使用メモリ 10,652 KB
実行使用メモリ 9,468 KB
最終ジャッジ日時 2023-09-20 18:02:45
合計ジャッジ時間 2,063 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,916 KB
testcase_01 AC 16 ms
8,032 KB
testcase_02 AC 15 ms
7,884 KB
testcase_03 AC 16 ms
7,928 KB
testcase_04 AC 15 ms
7,788 KB
testcase_05 AC 15 ms
7,996 KB
testcase_06 AC 15 ms
8,036 KB
testcase_07 AC 15 ms
7,952 KB
testcase_08 AC 22 ms
8,692 KB
testcase_09 AC 16 ms
8,120 KB
testcase_10 AC 26 ms
8,796 KB
testcase_11 AC 34 ms
9,344 KB
testcase_12 AC 23 ms
8,624 KB
testcase_13 AC 17 ms
8,052 KB
testcase_14 AC 27 ms
8,752 KB
testcase_15 AC 23 ms
8,736 KB
testcase_16 AC 35 ms
9,384 KB
testcase_17 AC 35 ms
9,388 KB
testcase_18 AC 35 ms
9,468 KB
testcase_19 AC 35 ms
9,364 KB
testcase_20 AC 35 ms
9,376 KB
testcase_21 AC 35 ms
9,368 KB
testcase_22 AC 35 ms
9,376 KB
testcase_23 AC 36 ms
9,444 KB
testcase_24 AC 19 ms
8,940 KB
testcase_25 AC 18 ms
8,716 KB
testcase_26 AC 17 ms
8,508 KB
testcase_27 AC 24 ms
8,276 KB
testcase_28 AC 36 ms
8,888 KB
testcase_29 AC 31 ms
8,584 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

X = list(input())
if len(set(X)) == 1:
    print(-1)
    exit()
    
X.sort()
for i in range(len(X)-1):
    if X[i] == X[i+1]:
        continue
    if i+1 < len(X)-1:
        X[i],X[i+1] = X[i+1],X[i]
        print("".join(X[::-1]))
        exit()
print(-1)
0