結果

問題 No.365 ジェンガソート
ユーザー iwot
提出日時 2020-06-23 10:07:07
言語 F#
(F# 4.0)
結果
AC  
実行時間 344 ms / 2,000 ms
コード長 444 bytes
コンパイル時間 10,327 ms
コンパイル使用メモリ 192,696 KB
実行使用メモリ 45,440 KB
最終ジャッジ日時 2024-07-03 19:11:51
合計ジャッジ時間 27,658 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 41
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (324 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 N = stdin.ReadLine() |> int
let A = stdin.ReadLine().Split(' ') |> Array.map int

let mutable count = 0
for i in N-1 .. -1 .. 0 do
    if A.[i] = N then
        let mutable find = N - 1
        let mutable tmpcount = 1
        for j in i-1 .. -1 .. 0 do
            if A.[j] = find then
                find <- A.[j] - 1
                tmpcount <- tmpcount + 1
        if tmpcount > count then count <- tmpcount

printfn "%d" <| N - count
0