結果

問題 No.927 Second Permutation
ユーザー ttrttr
提出日時 2020-02-04 18:36:38
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 57 ms / 2,000 ms
コード長 352 bytes
コンパイル時間 155 ms
コンパイル使用メモリ 11,940 KB
実行使用メモリ 11,240 KB
最終ジャッジ日時 2023-10-21 06:27:06
合計ジャッジ時間 2,653 ms
ジャッジサーバーID
(参考情報)
judge13 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
10,024 KB
testcase_01 AC 29 ms
10,024 KB
testcase_02 AC 27 ms
10,024 KB
testcase_03 AC 25 ms
10,024 KB
testcase_04 AC 25 ms
10,024 KB
testcase_05 AC 26 ms
10,024 KB
testcase_06 AC 26 ms
10,024 KB
testcase_07 AC 25 ms
10,024 KB
testcase_08 AC 36 ms
10,380 KB
testcase_09 AC 29 ms
10,048 KB
testcase_10 AC 44 ms
10,636 KB
testcase_11 AC 53 ms
11,188 KB
testcase_12 AC 43 ms
10,464 KB
testcase_13 AC 29 ms
10,120 KB
testcase_14 AC 43 ms
10,660 KB
testcase_15 AC 38 ms
10,452 KB
testcase_16 AC 56 ms
11,240 KB
testcase_17 AC 54 ms
11,240 KB
testcase_18 AC 54 ms
11,240 KB
testcase_19 AC 55 ms
11,240 KB
testcase_20 AC 57 ms
11,240 KB
testcase_21 AC 57 ms
11,240 KB
testcase_22 AC 57 ms
11,240 KB
testcase_23 AC 53 ms
11,240 KB
testcase_24 AC 42 ms
10,980 KB
testcase_25 AC 40 ms
10,660 KB
testcase_26 AC 34 ms
10,524 KB
testcase_27 AC 36 ms
10,340 KB
testcase_28 AC 56 ms
10,924 KB
testcase_29 AC 48 ms
10,660 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

X = input()

L = [0]*len(X)
for i in range(len(X)):
    L[i] = X[i]
L.sort(reverse=True)
if L[0] == L[-1]:
    print(-1)
else:
    for i in range(len(L)-1, 0, -1):
        if L[i] != L[i-1]:
            t = L[i]
            L[i] = L[i-1]
            L[i-1] = t
            break
    if L[0] != "0":
        print("".join(L))
    else:
        print(-1)
0