結果

問題 No.927 Second Permutation
ユーザー matriematrie
提出日時 2020-12-16 07:18:57
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 93 ms / 2,000 ms
コード長 224 bytes
コンパイル時間 97 ms
コンパイル使用メモリ 12,004 KB
実行使用メモリ 19,316 KB
最終ジャッジ日時 2023-10-20 08:59:36
合計ジャッジ時間 2,723 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,128 KB
testcase_01 AC 31 ms
10,128 KB
testcase_02 AC 29 ms
10,128 KB
testcase_03 AC 30 ms
10,128 KB
testcase_04 AC 28 ms
10,128 KB
testcase_05 AC 29 ms
10,128 KB
testcase_06 AC 29 ms
10,128 KB
testcase_07 AC 29 ms
10,128 KB
testcase_08 AC 47 ms
13,280 KB
testcase_09 AC 29 ms
10,336 KB
testcase_10 AC 57 ms
15,184 KB
testcase_11 AC 76 ms
18,388 KB
testcase_12 AC 51 ms
13,940 KB
testcase_13 AC 32 ms
10,756 KB
testcase_14 AC 59 ms
15,504 KB
testcase_15 AC 50 ms
13,924 KB
testcase_16 AC 80 ms
19,316 KB
testcase_17 AC 80 ms
19,316 KB
testcase_18 AC 80 ms
19,316 KB
testcase_19 AC 81 ms
19,316 KB
testcase_20 AC 83 ms
19,316 KB
testcase_21 AC 80 ms
19,316 KB
testcase_22 AC 81 ms
19,316 KB
testcase_23 AC 81 ms
19,316 KB
testcase_24 AC 49 ms
12,312 KB
testcase_25 AC 43 ms
11,596 KB
testcase_26 AC 39 ms
11,176 KB
testcase_27 AC 55 ms
13,600 KB
testcase_28 AC 93 ms
18,660 KB
testcase_29 AC 79 ms
16,872 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

s=list(map(int,list(input())))
s=sorted(s)[::-1]
l=[x for x in s]
x=-1
if len(set(l))>1:
	for i in range(1,len(s)):
		if l[-i]<l[-i-1]:
			l[-i],l[-i-1]=l[-i-1],l[-i]
			x=''.join(map(str,l)); break
if l[0]==0: x=-1
print(x)
0