結果

問題 No.1505 Zero-Product Ranges
ユーザー natoriusan
提出日時 2023-08-07 18:52:08
言語 F#
(F# 4.0)
結果
RE  
実行時間 -
コード長 328 bytes
コンパイル時間 7,688 ms
コンパイル使用メモリ 189,424 KB
実行使用メモリ 51,328 KB
最終ジャッジ日時 2024-11-07 23:49:45
合計ジャッジ時間 29,825 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18 RE * 31
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (267 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 lastZero = -1
[|
    for i in 0..a.Length-1 ->
        if a.[i] = 0 then
            let count = (i - lastZero) * (a.Length-i)
            lastZero <- i
            count
        else
            0
|] |> Array.sum |> printfn "%d"
0