結果
| 問題 | No.929 よくあるボールを移動するやつ |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-11-23 06:13:26 |
| 言語 | OCaml (5.5.0) |
| 結果 |
AC
不安定
|
| 実行時間 | 11 ms / 2,000 ms |
| + 421µs | |
| コード長 | 400 bytes |
| 記録 | |
| コンパイル時間 | 124 ms |
| コンパイル使用メモリ | 22,692 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-09-12 07:30:44 |
| 合計ジャッジ時間 | 1,816 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 12 |
コンパイルメッセージ
ocamlfind: [WARNING] Cannot read directory ./stublibs which is mentioned in ld.conf
ソースコード
open Scanf ;;
open Printf ;;
let input_int () = scanf " %d" (fun x -> x) ;;
let input_ints n = Array.init n (fun _ -> input_int ()) ;;
let () =
let n = input_int () in
let b = input_ints n in
let rec loop i s ans =
if i = n then ans
else begin
let s' = s + b.(i) in
let ans' = ans + abs (i - s) in
loop (i + 1) s' ans'
end
in
printf "%d\n" (loop 0 0 0)
;;