結果

問題 No.927 Second Permutation
ユーザー natoriusannatoriusan
提出日時 2023-08-01 21:27:29
言語 F#
(F# 4.0)
結果
WA  
実行時間 -
コード長 400 bytes
コンパイル時間 13,427 ms
コンパイル使用メモリ 183,952 KB
実行使用メモリ 37,776 KB
最終ジャッジ日時 2024-04-19 20:32:01
合計ジャッジ時間 15,283 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
31,104 KB
testcase_01 AC 67 ms
31,224 KB
testcase_02 AC 68 ms
31,104 KB
testcase_03 AC 66 ms
30,976 KB
testcase_04 AC 70 ms
30,848 KB
testcase_05 AC 68 ms
30,848 KB
testcase_06 AC 68 ms
30,964 KB
testcase_07 AC 69 ms
30,976 KB
testcase_08 AC 100 ms
33,536 KB
testcase_09 AC 72 ms
31,104 KB
testcase_10 AC 115 ms
34,412 KB
testcase_11 AC 143 ms
36,352 KB
testcase_12 AC 109 ms
34,044 KB
testcase_13 AC 80 ms
31,744 KB
testcase_14 AC 127 ms
34,304 KB
testcase_15 AC 115 ms
33,792 KB
testcase_16 AC 144 ms
36,724 KB
testcase_17 AC 146 ms
36,608 KB
testcase_18 AC 154 ms
36,608 KB
testcase_19 AC 144 ms
36,608 KB
testcase_20 AC 145 ms
36,480 KB
testcase_21 AC 149 ms
36,568 KB
testcase_22 AC 148 ms
36,608 KB
testcase_23 AC 149 ms
36,608 KB
testcase_24 AC 140 ms
36,224 KB
testcase_25 AC 119 ms
34,560 KB
testcase_26 AC 113 ms
33,792 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (384 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

let x = stdin.ReadLine () |> Seq.sortDescending |> Seq.map string |> String.concat ""

if x.Length = 1 || (x.Length = 2 && x.[1] = '0') || Seq.forall ((=)x.[0]) x then
    "-1"
else
    let mutable index = x.Length - 2
    while x.[index] = x.[index+1] do
        index <- index - 1
    (if index = 0 then "" else x.[..index-1]) + string x.[index+1] + string x.[index] + x.[index+2..]
|> printfn "%s"
0