結果

問題 No.927 Second Permutation
ユーザー jj1gujjj1guj
提出日時 2019-11-22 21:56:40
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 273 bytes
コンパイル時間 132 ms
コンパイル使用メモリ 82,328 KB
実行使用メモリ 66,612 KB
最終ジャッジ日時 2024-04-19 11:13:45
合計ジャッジ時間 2,340 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
51,940 KB
testcase_01 WA -
testcase_02 AC 35 ms
51,872 KB
testcase_03 AC 32 ms
53,868 KB
testcase_04 AC 33 ms
52,216 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 32 ms
51,812 KB
testcase_08 AC 42 ms
60,720 KB
testcase_09 AC 36 ms
52,348 KB
testcase_10 AC 49 ms
62,752 KB
testcase_11 AC 62 ms
64,688 KB
testcase_12 AC 52 ms
60,624 KB
testcase_13 AC 33 ms
53,420 KB
testcase_14 AC 48 ms
63,168 KB
testcase_15 AC 44 ms
61,100 KB
testcase_16 AC 62 ms
65,600 KB
testcase_17 AC 62 ms
65,416 KB
testcase_18 AC 61 ms
65,020 KB
testcase_19 AC 68 ms
64,840 KB
testcase_20 AC 61 ms
66,612 KB
testcase_21 AC 60 ms
64,620 KB
testcase_22 AC 59 ms
64,676 KB
testcase_23 AC 61 ms
64,360 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 41 ms
60,184 KB
testcase_28 AC 39 ms
63,620 KB
testcase_29 AC 40 ms
63,488 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

X=str(input())

X=sorted(X)
X.reverse()
X_origin=X

for i in range(len(X)-1):
    if X[len(X)-i-1]!=X[len(X)-i-2]:
        X[len(X)-i-1],X[len(X)-i-2]=X[len(X)-i-2],X[len(X)-i-1]
        break

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