結果
| 問題 | 
                            No.1505 Zero-Product Ranges
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2023-08-07 18:54:02 | 
| 言語 | F#  (F# 4.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 169 ms / 2,000 ms | 
| コード長 | 350 bytes | 
| コンパイル時間 | 8,657 ms | 
| コンパイル使用メモリ | 185,748 KB | 
| 実行使用メモリ | 62,720 KB | 
| 最終ジャッジ日時 | 2024-11-07 23:55:05 | 
| 合計ジャッジ時間 | 16,831 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 49 | 
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.fsproj を復元しました (250 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/
ソースコード
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 = bigint(i - lastZero) * bigint(a.Length-i)
            lastZero <- i
            count
        else
            0 |> bigint
|] |> Array.sum |> printfn "%A"