結果

問題 No.927 Second Permutation
ユーザー ああいい
提出日時 2022-05-17 11:02:31
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 284 bytes
コンパイル時間 392 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 85,376 KB
最終ジャッジ日時 2024-09-15 05:03:19
合計ジャッジ時間 3,993 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10 WA * 17
権限があれば一括ダウンロードができます

ソースコード

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[-1] = l[-1],l[u]
if l[0] == 0:
    print(-1)
    exit()
for i in l:
    print(i,end = "")
print()
0