結果

問題 No.927 Second Permutation
ユーザー gorugo30gorugo30
提出日時 2021-02-24 22:46:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 69 ms / 2,000 ms
コード長 223 bytes
コンパイル時間 1,585 ms
コンパイル使用メモリ 81,892 KB
実行使用メモリ 65,732 KB
最終ジャッジ日時 2023-10-25 04:12:49
合計ジャッジ時間 5,554 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,516 KB
testcase_01 AC 38 ms
53,516 KB
testcase_02 AC 37 ms
53,516 KB
testcase_03 AC 37 ms
53,516 KB
testcase_04 AC 37 ms
53,516 KB
testcase_05 AC 37 ms
53,516 KB
testcase_06 AC 37 ms
53,516 KB
testcase_07 AC 37 ms
53,516 KB
testcase_08 AC 49 ms
59,912 KB
testcase_09 AC 38 ms
53,516 KB
testcase_10 AC 55 ms
62,472 KB
testcase_11 AC 65 ms
63,476 KB
testcase_12 AC 51 ms
60,180 KB
testcase_13 AC 39 ms
53,516 KB
testcase_14 AC 57 ms
62,532 KB
testcase_15 AC 51 ms
60,164 KB
testcase_16 AC 69 ms
65,732 KB
testcase_17 AC 68 ms
63,508 KB
testcase_18 AC 68 ms
63,512 KB
testcase_19 AC 68 ms
65,556 KB
testcase_20 AC 68 ms
65,556 KB
testcase_21 AC 68 ms
65,556 KB
testcase_22 AC 69 ms
63,664 KB
testcase_23 AC 69 ms
63,664 KB
testcase_24 AC 42 ms
57,068 KB
testcase_25 AC 40 ms
56,580 KB
testcase_26 AC 39 ms
56,308 KB
testcase_27 AC 39 ms
54,104 KB
testcase_28 AC 41 ms
56,996 KB
testcase_29 AC 41 ms
56,716 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

X = list(input())
X.sort(reverse = True)
if X.count("0") == len(X) - 1 or X.count(X[0]) == len(X):
    print(-1)
    exit()
i = len(X) - 1
while X[i] == X[i - 1]:
    i -= 1
X[i], X[i - 1] = X[i - 1], X[i]
print("".join(X))
0