結果

問題 No.927 Second Permutation
ユーザー osrgy01osrgy01
提出日時 2021-06-05 14:09:32
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 65 ms / 2,000 ms
コード長 240 bytes
コンパイル時間 132 ms
コンパイル使用メモリ 10,732 KB
実行使用メモリ 16,724 KB
最終ジャッジ日時 2023-08-13 15:52:18
合計ジャッジ時間 4,749 ms
ジャッジサーバーID
(参考情報)
judge14 / judge10
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,192 KB
testcase_01 AC 16 ms
7,756 KB
testcase_02 AC 17 ms
8,100 KB
testcase_03 AC 17 ms
8,020 KB
testcase_04 AC 17 ms
8,188 KB
testcase_05 AC 16 ms
7,672 KB
testcase_06 AC 16 ms
7,932 KB
testcase_07 AC 16 ms
8,112 KB
testcase_08 AC 33 ms
10,960 KB
testcase_09 AC 18 ms
8,284 KB
testcase_10 AC 43 ms
12,532 KB
testcase_11 AC 61 ms
15,724 KB
testcase_12 AC 37 ms
11,736 KB
testcase_13 AC 19 ms
8,788 KB
testcase_14 AC 44 ms
12,836 KB
testcase_15 AC 35 ms
11,572 KB
testcase_16 AC 64 ms
16,532 KB
testcase_17 AC 65 ms
16,592 KB
testcase_18 AC 65 ms
16,680 KB
testcase_19 AC 65 ms
16,696 KB
testcase_20 AC 65 ms
16,720 KB
testcase_21 AC 64 ms
16,684 KB
testcase_22 AC 65 ms
16,592 KB
testcase_23 AC 64 ms
16,724 KB
testcase_24 AC 48 ms
9,520 KB
testcase_25 AC 38 ms
8,944 KB
testcase_26 AC 32 ms
8,816 KB
testcase_27 AC 29 ms
8,704 KB
testcase_28 AC 48 ms
9,480 KB
testcase_29 AC 41 ms
9,400 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

t=sorted(map(int,[*input()]))
for i in range(1,len(t)):
    if t[i-1]!=t[i]:
        t[i-1],t[i]=t[i],t[i-1]
        if t[::-1][0]==0:
            print(-1)
        else:
            print(''.join(map(str,t[::-1])))
        exit()
print(-1)
0