結果

問題 No.231 めぐるはめぐる (1)
ユーザー xsdxsd
提出日時 2020-06-20 11:48:51
言語 OCaml
(5.1.0)
結果
WA  
実行時間 -
コード長 544 bytes
コンパイル時間 273 ms
コンパイル使用メモリ 19,708 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-07-30 07:36:40
合計ジャッジ時間 2,123 ms
ジャッジサーバーID
(参考情報)
judge5 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 WA -
testcase_04 AC 3 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

Scanf.scanf "%d" (fun n ->
    let gd = Array.init n (fun v -> Scanf.scanf " %d %d" (fun g d -> g, d, v)) in
    Array.sort (fun (g1, d1, _) (g2, d2, _) ->
        compare (g2 - 30000 * d2) (g1 - 30000 * d1)) gd;
    let rec loop i acc =
        if i = 6 then acc else
            let g, d, _ = gd.(0) in
            loop (i + 1) (acc + g - 30000 * d)
    in
    let k = loop 0 0 in
    if k >= 3000000 then (
        print_endline "YES";
        for i = 0 to 5 do
            Printf.printf "%d\n" 1
        done
    ) else print_endline "NO"
)
0