結果

問題 No.927 Second Permutation
ユーザー komkompikomkompi
提出日時 2019-11-25 22:00:34
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 50 ms / 2,000 ms
コード長 283 bytes
コンパイル時間 357 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 12,348 KB
最終ジャッジ日時 2024-04-22 16:41:37
合計ジャッジ時間 2,502 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
10,240 KB
testcase_01 AC 25 ms
10,496 KB
testcase_02 AC 27 ms
10,496 KB
testcase_03 AC 26 ms
10,496 KB
testcase_04 AC 26 ms
10,496 KB
testcase_05 AC 26 ms
10,496 KB
testcase_06 AC 26 ms
10,496 KB
testcase_07 AC 25 ms
10,496 KB
testcase_08 AC 32 ms
11,008 KB
testcase_09 AC 26 ms
10,496 KB
testcase_10 AC 35 ms
11,464 KB
testcase_11 AC 42 ms
12,004 KB
testcase_12 AC 34 ms
11,264 KB
testcase_13 AC 30 ms
10,496 KB
testcase_14 AC 37 ms
11,592 KB
testcase_15 AC 33 ms
11,392 KB
testcase_16 AC 44 ms
12,092 KB
testcase_17 AC 45 ms
12,176 KB
testcase_18 AC 43 ms
12,348 KB
testcase_19 AC 45 ms
12,220 KB
testcase_20 AC 47 ms
12,220 KB
testcase_21 AC 44 ms
12,044 KB
testcase_22 AC 46 ms
12,220 KB
testcase_23 AC 46 ms
12,176 KB
testcase_24 AC 30 ms
12,032 KB
testcase_25 AC 29 ms
11,648 KB
testcase_26 AC 29 ms
11,264 KB
testcase_27 AC 37 ms
11,264 KB
testcase_28 AC 50 ms
12,032 KB
testcase_29 AC 46 ms
11,776 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8
# Your code here!
X=list(input())

X.sort(reverse=True)
temp=X[:]

i=-1
while True:
    if X[i]=="0" and X[i-1]=="0":
        i-=1
    else:
        break

#print(i)
X[i-1],X[i]=X[i],X[i-1]

#print(X)
if temp==X or X[0]=="0":
    print(-1)
else:
    print("".join(X))
0