結果

問題 No.927 Second Permutation
ユーザー jj1gujjj1guj
提出日時 2019-11-22 21:53:46
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 273 bytes
コンパイル時間 75 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 12,032 KB
最終ジャッジ日時 2024-04-19 11:08:29
合計ジャッジ時間 2,115 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
10,624 KB
testcase_01 AC 26 ms
10,624 KB
testcase_02 AC 27 ms
10,752 KB
testcase_03 AC 28 ms
10,624 KB
testcase_04 AC 27 ms
10,752 KB
testcase_05 AC 28 ms
10,624 KB
testcase_06 AC 25 ms
10,624 KB
testcase_07 WA -
testcase_08 AC 32 ms
10,880 KB
testcase_09 AC 26 ms
10,624 KB
testcase_10 AC 38 ms
11,392 KB
testcase_11 AC 46 ms
12,032 KB
testcase_12 AC 34 ms
11,136 KB
testcase_13 AC 28 ms
10,624 KB
testcase_14 AC 37 ms
11,392 KB
testcase_15 AC 35 ms
11,392 KB
testcase_16 AC 49 ms
12,032 KB
testcase_17 AC 48 ms
12,032 KB
testcase_18 AC 46 ms
12,032 KB
testcase_19 AC 45 ms
11,904 KB
testcase_20 AC 45 ms
12,032 KB
testcase_21 AC 46 ms
12,032 KB
testcase_22 AC 45 ms
12,032 KB
testcase_23 AC 47 ms
11,904 KB
testcase_24 AC 74 ms
11,520 KB
testcase_25 AC 57 ms
11,136 KB
testcase_26 AC 52 ms
11,136 KB
testcase_27 AC 47 ms
11,008 KB
testcase_28 AC 71 ms
11,392 KB
testcase_29 AC 64 ms
11,392 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

X=str(input())
X_origin=X

X=sorted(X)
X.reverse()

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