結果

問題 No.927 Second Permutation
ユーザー natoriusannatoriusan
提出日時 2023-08-01 21:34:28
言語 F#
(F# 4.0)
結果
WA  
実行時間 -
コード長 410 bytes
コンパイル時間 11,966 ms
コンパイル使用メモリ 185,948 KB
実行使用メモリ 43,648 KB
最終ジャッジ日時 2024-04-19 20:37:22
合計ジャッジ時間 14,293 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
31,220 KB
testcase_01 AC 72 ms
31,104 KB
testcase_02 AC 69 ms
31,060 KB
testcase_03 AC 73 ms
31,224 KB
testcase_04 AC 74 ms
31,064 KB
testcase_05 AC 76 ms
31,104 KB
testcase_06 AC 74 ms
30,848 KB
testcase_07 WA -
testcase_08 AC 116 ms
35,840 KB
testcase_09 AC 79 ms
31,616 KB
testcase_10 AC 131 ms
38,016 KB
testcase_11 AC 161 ms
42,484 KB
testcase_12 AC 118 ms
36,608 KB
testcase_13 AC 86 ms
32,512 KB
testcase_14 AC 135 ms
38,648 KB
testcase_15 AC 124 ms
36,568 KB
testcase_16 AC 175 ms
43,264 KB
testcase_17 AC 171 ms
43,392 KB
testcase_18 AC 172 ms
43,392 KB
testcase_19 AC 176 ms
43,648 KB
testcase_20 AC 170 ms
43,648 KB
testcase_21 AC 175 ms
43,520 KB
testcase_22 AC 175 ms
43,392 KB
testcase_23 AC 173 ms
43,264 KB
testcase_24 AC 150 ms
36,224 KB
testcase_25 AC 126 ms
34,560 KB
testcase_26 AC 115 ms
34,040 KB
testcase_27 AC 108 ms
33,524 KB
testcase_28 AC 147 ms
35,956 KB
testcase_29 AC 133 ms
35,200 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (295 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 ""

let s = Set.ofSeq x
if x.Length = 1 || s.Count = 1 || (s.Count = 2 && s.Contains '0') 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