結果

問題 No.927 Second Permutation
ユーザー DrDrpilotDrDrpilot
提出日時 2022-01-30 13:57:04
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 36 ms / 2,000 ms
コード長 247 bytes
コンパイル時間 256 ms
コンパイル使用メモリ 10,596 KB
実行使用メモリ 9,248 KB
最終ジャッジ日時 2023-09-02 01:35:34
合計ジャッジ時間 5,174 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,976 KB
testcase_01 AC 15 ms
8,140 KB
testcase_02 AC 16 ms
7,960 KB
testcase_03 AC 15 ms
8,012 KB
testcase_04 AC 15 ms
8,024 KB
testcase_05 AC 16 ms
8,048 KB
testcase_06 AC 16 ms
7,972 KB
testcase_07 AC 16 ms
7,832 KB
testcase_08 AC 22 ms
8,416 KB
testcase_09 AC 16 ms
7,896 KB
testcase_10 AC 27 ms
8,684 KB
testcase_11 AC 34 ms
9,008 KB
testcase_12 AC 24 ms
8,548 KB
testcase_13 AC 17 ms
8,032 KB
testcase_14 AC 27 ms
8,488 KB
testcase_15 AC 24 ms
8,476 KB
testcase_16 AC 36 ms
9,248 KB
testcase_17 AC 36 ms
9,100 KB
testcase_18 AC 36 ms
9,128 KB
testcase_19 AC 36 ms
9,080 KB
testcase_20 AC 36 ms
9,244 KB
testcase_21 AC 36 ms
9,080 KB
testcase_22 AC 36 ms
9,160 KB
testcase_23 AC 34 ms
9,108 KB
testcase_24 AC 19 ms
8,868 KB
testcase_25 AC 19 ms
8,716 KB
testcase_26 AC 17 ms
8,428 KB
testcase_27 AC 17 ms
8,056 KB
testcase_28 AC 20 ms
8,948 KB
testcase_29 AC 18 ms
8,584 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

x=list(input())
x.sort(reverse=True)
n=len(x)
if len(set(x))==1:
    print(-1)
    exit()
if x.count('0')==n-1:
    print(-1)
    exit()
for i in range(n-1,0,-1):
    if x[i]!=x[i-1]:
        x[i],x[i-1]=x[i-1],x[i]
        break
print(''.join(x))
0