結果

問題 No.927 Second Permutation
ユーザー YamadaYamada
提出日時 2019-11-25 20:18:31
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 91 ms / 2,000 ms
コード長 248 bytes
コンパイル時間 106 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 18,084 KB
最終ジャッジ日時 2024-04-22 14:31:57
合計ジャッジ時間 3,235 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,752 KB
testcase_01 AC 31 ms
10,624 KB
testcase_02 AC 30 ms
10,752 KB
testcase_03 AC 30 ms
10,624 KB
testcase_04 AC 30 ms
10,752 KB
testcase_05 AC 30 ms
10,752 KB
testcase_06 AC 30 ms
10,752 KB
testcase_07 AC 30 ms
10,624 KB
testcase_08 AC 50 ms
13,184 KB
testcase_09 AC 31 ms
10,880 KB
testcase_10 AC 63 ms
14,948 KB
testcase_11 AC 83 ms
17,532 KB
testcase_12 AC 55 ms
13,824 KB
testcase_13 AC 35 ms
11,136 KB
testcase_14 AC 64 ms
15,064 KB
testcase_15 AC 54 ms
13,696 KB
testcase_16 AC 87 ms
17,764 KB
testcase_17 AC 90 ms
17,956 KB
testcase_18 AC 91 ms
17,952 KB
testcase_19 AC 87 ms
18,080 KB
testcase_20 AC 88 ms
17,952 KB
testcase_21 AC 88 ms
17,956 KB
testcase_22 AC 88 ms
17,952 KB
testcase_23 AC 87 ms
18,084 KB
testcase_24 AC 72 ms
11,776 KB
testcase_25 AC 59 ms
11,392 KB
testcase_26 AC 51 ms
11,392 KB
testcase_27 AC 48 ms
11,136 KB
testcase_28 AC 69 ms
11,648 KB
testcase_29 AC 62 ms
11,648 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

X = [int(i) for i in input()]
X.sort()
s = True
for i in range(len(X)-1):
    if X[i] != X[i+1]:
        X[i],X[i+1] = X[i+1],X[i]
        s = False
        break
if s or X[-1] ==0:
    print(-1)
else:
    print("".join([str(i) for i in X[::-1]]))
0