結果

問題 No.927 Second Permutation
ユーザー ohanaohana
提出日時 2023-10-30 15:29:07
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 79 ms / 2,000 ms
コード長 300 bytes
コンパイル時間 224 ms
コンパイル使用メモリ 81,848 KB
実行使用メモリ 73,480 KB
最終ジャッジ日時 2023-10-30 15:29:12
合計ジャッジ時間 5,289 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,592 KB
testcase_01 AC 35 ms
53,592 KB
testcase_02 AC 35 ms
53,592 KB
testcase_03 AC 35 ms
53,592 KB
testcase_04 AC 35 ms
53,592 KB
testcase_05 AC 39 ms
53,592 KB
testcase_06 AC 35 ms
53,592 KB
testcase_07 AC 35 ms
53,592 KB
testcase_08 AC 50 ms
63,440 KB
testcase_09 AC 39 ms
59,272 KB
testcase_10 AC 58 ms
67,344 KB
testcase_11 AC 71 ms
71,224 KB
testcase_12 AC 54 ms
64,300 KB
testcase_13 AC 40 ms
59,288 KB
testcase_14 AC 72 ms
67,848 KB
testcase_15 AC 79 ms
64,284 KB
testcase_16 AC 75 ms
73,480 KB
testcase_17 AC 74 ms
71,256 KB
testcase_18 AC 74 ms
73,304 KB
testcase_19 AC 76 ms
73,304 KB
testcase_20 AC 74 ms
73,304 KB
testcase_21 AC 73 ms
73,304 KB
testcase_22 AC 74 ms
73,304 KB
testcase_23 AC 75 ms
73,304 KB
testcase_24 AC 38 ms
57,144 KB
testcase_25 AC 39 ms
56,656 KB
testcase_26 AC 37 ms
56,384 KB
testcase_27 AC 39 ms
59,816 KB
testcase_28 AC 41 ms
62,696 KB
testcase_29 AC 42 ms
62,416 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

A = list(input())

if len(set(A)) == 1 or len([a for a in A if a != "0"]) == 1:
    print(-1)
else:
    A.sort()
    for i in range(len(A) - 1):
        if A[i] != A[i + 1]:
            A[i], A[i + 1] = A[i + 1], A[i]
            print("".join(A)[::-1])
            break
    else:
        print(-1)
0