結果

問題 No.365 ジェンガソート
コンテスト
ユーザー iwot
提出日時 2020-06-23 10:07:07
言語 F#
(F# 10.0)
コンパイル:
fsharp_c _filename_
実行:
/usr/bin/dotnet_wrap
結果
AC  
実行時間 244 ms / 2,000 ms
コード長 444 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 6,784 ms
コンパイル使用メモリ 209,740 KB
実行使用メモリ 48,000 KB
最終ジャッジ日時 2026-03-25 02:48:15
合計ジャッジ時間 19,564 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 41
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (188 ミリ秒)。
  main -> /home/judge/data/code/bin/Release/net10.0/main.dll
  main -> /home/judge/data/code/bin/Release/net10.0/publish/

ソースコード

diff #
raw source code

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