結果

問題 No.927 Second Permutation
ユーザー Maboy
提出日時 2021-06-28 05:55:47
言語 Swift
(6.0.3)
結果
WA  
実行時間 -
コード長 275 bytes
コンパイル時間 1,307 ms
コンパイル使用メモリ 127,832 KB
実行使用メモリ 12,928 KB
最終ジャッジ日時 2024-06-25 11:59:28
合計ジャッジ時間 2,923 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

var l = Array(String(readLine()!)).sorted(by: >)
var s = Set(l)
if s.count < 2 || (l.count == 2 && l.contains("0")){
    print(-1)
}else{
    let e = l[l.count - 1]
    let f = l.firstIndex(of: e)!
    (l[f - 1],l[f]) = (l[f],l[f - 1])
    print(l.map{String($0)}.joined())
}
0