結果

問題 No.2275 →↑↓
ユーザー natoriusannatoriusan
提出日時 2023-07-31 17:26:31
言語 F#
(F# 4.0)
結果
AC  
実行時間 358 ms / 2,000 ms
コード長 588 bytes
コンパイル時間 7,441 ms
コンパイル使用メモリ 187,936 KB
実行使用メモリ 63,340 KB
最終ジャッジ日時 2024-04-18 17:28:35
合計ジャッジ時間 11,786 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 297 ms
35,208 KB
testcase_01 AC 297 ms
35,192 KB
testcase_02 AC 297 ms
34,720 KB
testcase_03 AC 293 ms
35,072 KB
testcase_04 AC 293 ms
34,316 KB
testcase_05 AC 292 ms
34,180 KB
testcase_06 AC 340 ms
60,336 KB
testcase_07 AC 322 ms
55,460 KB
testcase_08 AC 349 ms
62,756 KB
testcase_09 AC 355 ms
62,744 KB
testcase_10 AC 358 ms
63,208 KB
testcase_11 AC 351 ms
63,340 KB
testcase_12 AC 357 ms
62,880 KB
testcase_13 AC 350 ms
62,612 KB
testcase_14 AC 352 ms
62,616 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /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/

ソースコード

diff #

let n = stdin.ReadLine () |> int
let a = stdin.ReadLine().Split " " |> Array.map int


if a.Length > 2 then
    [|
        for i in 0..a.Length-2 ->
            min a.[i] a.[i+1] |> int64
    |] |> Array.reduce (fun prev x -> prev * x % 998244353L)
else
    (Array.min a |> int64) % 998244353L
|> printfn "%d"

// let mutable arr = Array.replicate n [||]
// arr.[0] <- Array.replicate a.[0] 1L
// for i in 1..n-1 do
//     arr.[i] <- Array.replicate a.[i] ((Array.sum arr.[i-1].[0..a.[i]-1]) % 998244353L)
//     // printfn "%A" arr
//     
// Array.last arr |> Array.head |> printfn "%d"
0