結果

問題 No.927 Second Permutation
ユーザー deideirodeideiro
提出日時 2019-11-22 22:06:44
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 249 bytes
コンパイル時間 142 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 17,824 KB
最終ジャッジ日時 2024-04-19 11:33:38
合計ジャッジ時間 22,505 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
17,824 KB
testcase_01 AC 26 ms
10,624 KB
testcase_02 AC 28 ms
10,624 KB
testcase_03 AC 29 ms
10,624 KB
testcase_04 AC 29 ms
10,624 KB
testcase_05 AC 31 ms
10,624 KB
testcase_06 AC 29 ms
10,496 KB
testcase_07 AC 27 ms
10,624 KB
testcase_08 AC 272 ms
12,036 KB
testcase_09 AC 32 ms
10,752 KB
testcase_10 AC 600 ms
12,700 KB
testcase_11 AC 1,543 ms
14,444 KB
testcase_12 AC 373 ms
12,368 KB
testcase_13 AC 41 ms
10,880 KB
testcase_14 AC 636 ms
12,880 KB
testcase_15 AC 351 ms
12,352 KB
testcase_16 AC 1,851 ms
14,652 KB
testcase_17 AC 1,779 ms
14,864 KB
testcase_18 AC 1,793 ms
14,476 KB
testcase_19 AC 1,804 ms
14,604 KB
testcase_20 AC 1,805 ms
14,600 KB
testcase_21 AC 1,845 ms
14,604 KB
testcase_22 AC 1,851 ms
14,600 KB
testcase_23 AC 1,786 ms
14,472 KB
testcase_24 TLE -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#yukicoder
import copy
X = list(input())
X = sorted(X)[::-1]
XX = copy.deepcopy(X)

for i in range(len(X)-1,0,-1):
    XX[i],XX[i-1] = XX[i-1],XX[i]
    if X != XX:
        break
if XX[0] == "0" or X == XX:
    print(-1)
else:
    print(*XX,sep="")
0