結果

問題 No.365 ジェンガソート
ユーザー kuuso1
提出日時 2016-09-06 23:59:32
言語 F#
(F# 4.0)
結果
AC  
実行時間 360 ms / 2,000 ms
コード長 485 bytes
コンパイル時間 12,990 ms
コンパイル使用メモリ 195,104 KB
実行使用メモリ 45,696 KB
最終ジャッジ日時 2024-11-15 20:59:55
合計ジャッジ時間 25,999 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 41
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (299 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 #

open System

let ri () = stdin.ReadLine() |> int
let ria () = stdin.ReadLine().Split() |> Array.map int

type Sol() =
    member this.Solve() = 
        let N = ri ()
        let A = ria ()
        
        let rec f (ar: int[]) i n sum =
            match i with
            | -1 -> sum
            | _ when ar.[i] = n -> f ar (i-1) (n-1) sum
            | _ -> f ar (i-1) n (sum+1)
        
        f A (N-1) N 0 |> printfn "%d"
        
        
let mySol = new Sol()
mySol.Solve()
0