結果

問題 No.647 明太子
ユーザー xsdxsd
提出日時 2020-06-29 23:51:47
言語 OCaml
(5.1.0)
結果
AC  
実行時間 120 ms / 4,500 ms
コード長 631 bytes
コンパイル時間 244 ms
コンパイル使用メモリ 21,580 KB
実行使用メモリ 6,144 KB
最終ジャッジ日時 2024-04-17 09:04:47
合計ジャッジ時間 1,785 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 3 ms
5,376 KB
testcase_10 AC 4 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 4 ms
5,376 KB
testcase_13 AC 6 ms
5,376 KB
testcase_14 AC 41 ms
6,144 KB
testcase_15 AC 8 ms
5,376 KB
testcase_16 AC 9 ms
5,376 KB
testcase_17 AC 120 ms
6,016 KB
testcase_18 AC 69 ms
6,144 KB
testcase_19 AC 11 ms
5,888 KB
testcase_20 AC 10 ms
5,888 KB
testcase_21 AC 6 ms
5,376 KB
testcase_22 AC 34 ms
6,016 KB
testcase_23 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

Scanf.scanf "%d" (fun n ->
    let ab = Array.init n (fun _ -> Scanf.scanf " %d %d" (fun a b -> a, b)) in
    Scanf.scanf " %d" (fun m ->
        let hist = Array.make m 0 in
        for j = 0 to m - 1 do
            Scanf.scanf " %d %d" (fun x y ->
                for i = 0 to n - 1 do
                    let a, b = ab.(i) in
                    if x <= a && y >= b then hist.(j) <- hist.(j) + 1
                done
            )
        done;
        let d = Array.fold_left max 0 hist in
        if d = 0 then print_endline "0" else
            Array.iteri (fun i v -> if v = d then Printf.printf "%d\n" (i + 1)) hist
    )
)
0