結果

問題 No.927 Second Permutation
ユーザー zyxwzyxw
提出日時 2021-02-06 10:45:16
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 249 ms / 2,000 ms
コード長 440 bytes
コンパイル時間 142 ms
コンパイル使用メモリ 10,896 KB
実行使用メモリ 10,000 KB
最終ジャッジ日時 2023-09-15 15:04:16
合計ジャッジ時間 7,002 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,852 KB
testcase_01 AC 16 ms
7,908 KB
testcase_02 AC 16 ms
7,768 KB
testcase_03 AC 15 ms
7,932 KB
testcase_04 AC 15 ms
7,876 KB
testcase_05 AC 15 ms
7,816 KB
testcase_06 AC 15 ms
7,832 KB
testcase_07 AC 15 ms
7,844 KB
testcase_08 AC 62 ms
8,808 KB
testcase_09 AC 17 ms
7,828 KB
testcase_10 AC 106 ms
9,080 KB
testcase_11 AC 216 ms
9,780 KB
testcase_12 AC 77 ms
8,960 KB
testcase_13 AC 22 ms
8,336 KB
testcase_14 AC 116 ms
9,344 KB
testcase_15 AC 74 ms
8,920 KB
testcase_16 AC 246 ms
9,836 KB
testcase_17 AC 244 ms
9,892 KB
testcase_18 AC 247 ms
9,920 KB
testcase_19 AC 244 ms
9,988 KB
testcase_20 AC 249 ms
9,816 KB
testcase_21 AC 245 ms
9,912 KB
testcase_22 AC 248 ms
9,960 KB
testcase_23 AC 243 ms
10,000 KB
testcase_24 AC 35 ms
9,724 KB
testcase_25 AC 28 ms
9,168 KB
testcase_26 AC 25 ms
8,972 KB
testcase_27 AC 24 ms
8,868 KB
testcase_28 AC 35 ms
9,544 KB
testcase_29 AC 31 ms
9,420 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

X=sorted([int(s) for s in list(input())])
X_set=sorted(list(set(X)))
if len(X_set)==1 or (len(X_set)==2 and X_set[0]==0 and  X.count(X_set[1])==1):
    print(-1)
else:
    for i in range(1,len(X)):
        if X[i]!=X[i-1]:
            a=0
            a+=X[i]
            b=0
            b+=X[i-1]
            X[i]=b
            X[i-1]=a
            break
    ans=""
    for i in range(len(X)):
        ans+=str(X[len(X)-i-1])
    print(ans)
0