結果

問題 No.927 Second Permutation
ユーザー miya145592miya145592
提出日時 2023-05-21 04:02:25
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 101 ms / 2,000 ms
コード長 234 bytes
コンパイル時間 269 ms
コンパイル使用メモリ 87,284 KB
実行使用メモリ 78,156 KB
最終ジャッジ日時 2023-08-23 11:56:56
合計ジャッジ時間 5,325 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,272 KB
testcase_01 AC 70 ms
71,436 KB
testcase_02 AC 71 ms
71,140 KB
testcase_03 AC 68 ms
71,024 KB
testcase_04 AC 72 ms
71,244 KB
testcase_05 AC 70 ms
71,236 KB
testcase_06 AC 71 ms
71,140 KB
testcase_07 AC 70 ms
71,068 KB
testcase_08 AC 79 ms
76,164 KB
testcase_09 AC 69 ms
71,352 KB
testcase_10 AC 87 ms
76,612 KB
testcase_11 AC 97 ms
77,596 KB
testcase_12 AC 82 ms
76,420 KB
testcase_13 AC 71 ms
71,344 KB
testcase_14 AC 87 ms
76,916 KB
testcase_15 AC 83 ms
76,368 KB
testcase_16 AC 98 ms
78,156 KB
testcase_17 AC 100 ms
77,856 KB
testcase_18 AC 101 ms
77,656 KB
testcase_19 AC 100 ms
77,852 KB
testcase_20 AC 98 ms
77,452 KB
testcase_21 AC 100 ms
77,724 KB
testcase_22 AC 101 ms
77,456 KB
testcase_23 AC 98 ms
77,720 KB
testcase_24 AC 78 ms
77,016 KB
testcase_25 AC 75 ms
76,376 KB
testcase_26 AC 72 ms
76,408 KB
testcase_27 AC 75 ms
76,484 KB
testcase_28 AC 77 ms
77,196 KB
testcase_29 AC 76 ms
76,812 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

X = list(input())
X.sort(reverse=True)
for i in range(len(X)-1, 0, -1):
    if X[i]!=X[i-1]:
        if X[i]=="0" and i-1==0:
            continue
        X[i], X[i-1] = X[i-1], X[i]
        print("".join(X))
        exit()
print(-1)
0