結果

問題 No.1090 ソーシャルディスタンス / Social Distance
ユーザー xsdxsd
提出日時 2020-06-25 01:23:42
言語 OCaml
(5.1.0)
結果
AC  
実行時間 46 ms / 2,000 ms
コード長 395 bytes
コンパイル時間 240 ms
コンパイル使用メモリ 21,452 KB
実行使用メモリ 7,296 KB
最終ジャッジ日時 2024-04-17 09:04:09
合計ジャッジ時間 2,781 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 31 ms
6,784 KB
testcase_03 AC 7 ms
5,888 KB
testcase_04 AC 36 ms
6,912 KB
testcase_05 AC 5 ms
5,376 KB
testcase_06 AC 43 ms
7,168 KB
testcase_07 AC 23 ms
6,528 KB
testcase_08 AC 44 ms
7,296 KB
testcase_09 AC 24 ms
6,528 KB
testcase_10 AC 31 ms
6,784 KB
testcase_11 AC 46 ms
7,296 KB
testcase_12 AC 26 ms
6,656 KB
testcase_13 AC 26 ms
6,784 KB
testcase_14 AC 41 ms
7,168 KB
testcase_15 AC 32 ms
6,784 KB
testcase_16 AC 17 ms
6,272 KB
testcase_17 AC 3 ms
5,376 KB
testcase_18 AC 17 ms
6,144 KB
testcase_19 AC 22 ms
6,528 KB
testcase_20 AC 20 ms
6,528 KB
testcase_21 AC 25 ms
6,656 KB
testcase_22 AC 2 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 46 ms
7,296 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

Scanf.scanf "%d %d" (fun n d ->
    let a = Array.init n (fun i ->
        if i = 0 then 0 else Scanf.scanf " %d" (fun a -> a))
    in
    let b = Array.make n 0 in
    for i = 1 to n - 1 do
        a.(i) <- a.(i) + a.(i - 1);
        b.(i) <- max a.(i) (b.(i - 1) + d)
    done;
    Printf.printf "0";
    for i = 1 to n - 1 do
        Printf.printf " %d" b.(i)
    done;
    print_newline ()
)
0