結果

問題 No.927 Second Permutation
ユーザー ああいいああいい
提出日時 2022-05-17 11:04:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 120 ms / 2,000 ms
コード長 290 bytes
コンパイル時間 573 ms
コンパイル使用メモリ 87,080 KB
実行使用メモリ 86,520 KB
最終ジャッジ日時 2023-10-13 07:54:49
合計ジャッジ時間 4,617 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,452 KB
testcase_01 AC 71 ms
71,112 KB
testcase_02 AC 70 ms
71,292 KB
testcase_03 AC 70 ms
71,476 KB
testcase_04 AC 70 ms
71,488 KB
testcase_05 AC 70 ms
71,460 KB
testcase_06 AC 70 ms
71,580 KB
testcase_07 AC 71 ms
71,264 KB
testcase_08 AC 101 ms
79,968 KB
testcase_09 AC 81 ms
76,960 KB
testcase_10 AC 106 ms
81,624 KB
testcase_11 AC 114 ms
85,444 KB
testcase_12 AC 104 ms
80,804 KB
testcase_13 AC 84 ms
77,024 KB
testcase_14 AC 106 ms
82,384 KB
testcase_15 AC 102 ms
80,676 KB
testcase_16 AC 119 ms
86,520 KB
testcase_17 AC 118 ms
86,100 KB
testcase_18 AC 119 ms
85,840 KB
testcase_19 AC 116 ms
85,864 KB
testcase_20 AC 120 ms
86,040 KB
testcase_21 AC 118 ms
86,116 KB
testcase_22 AC 116 ms
85,896 KB
testcase_23 AC 118 ms
85,864 KB
testcase_24 AC 82 ms
83,424 KB
testcase_25 AC 83 ms
80,772 KB
testcase_26 AC 76 ms
79,044 KB
testcase_27 AC 79 ms
78,512 KB
testcase_28 AC 84 ms
83,012 KB
testcase_29 AC 82 ms
81,948 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

X = input()
l = list(map(int,list(X)))
s = set(l)
N = len(l)
import sys

if len(s) == 1:
    print(-1)
    exit()
l.sort(reverse = True)
u = N - 1
while l[u] == l[-1]:
    u -= 1
l[u],l[u + 1] = l[u + 1],l[u]
if l[0] == 0:
    print(-1)
    exit()
for i in l:
    print(i,end = "")
print()
0