結果

問題 No.1133 キムワイプイーター
ユーザー xsdxsd
提出日時 2020-08-15 13:44:49
言語 OCaml
(5.1.0)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 536 bytes
コンパイル時間 479 ms
コンパイル使用メモリ 21,700 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2024-04-17 09:10:07
合計ジャッジ時間 2,554 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 12 ms
5,376 KB
testcase_03 AC 26 ms
7,656 KB
testcase_04 AC 25 ms
7,436 KB
testcase_05 AC 31 ms
7,720 KB
testcase_06 AC 26 ms
7,064 KB
testcase_07 AC 20 ms
6,016 KB
testcase_08 AC 15 ms
5,376 KB
testcase_09 AC 21 ms
6,232 KB
testcase_10 AC 30 ms
6,828 KB
testcase_11 AC 29 ms
7,364 KB
testcase_12 AC 27 ms
7,712 KB
testcase_13 AC 28 ms
6,980 KB
testcase_14 AC 17 ms
5,512 KB
testcase_15 AC 15 ms
5,504 KB
testcase_16 AC 13 ms
5,376 KB
testcase_17 AC 6 ms
5,376 KB
testcase_18 AC 11 ms
5,376 KB
testcase_19 AC 6 ms
5,376 KB
testcase_20 AC 9 ms
5,376 KB
testcase_21 AC 11 ms
5,376 KB
testcase_22 AC 12 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 2 ms
5,376 KB
testcase_25 AC 5 ms
5,376 KB
testcase_26 AC 2 ms
5,376 KB
testcase_27 AC 2 ms
5,376 KB
testcase_28 AC 2 ms
5,376 KB
testcase_29 AC 1 ms
5,376 KB
testcase_30 AC 12 ms
5,376 KB
testcase_31 AC 2 ms
5,376 KB
testcase_32 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

Scanf.scanf "%d %d %s" (fun n m s ->
    let mat = Array.make_matrix (n + 1) (n + 1) 1 in
    mat.(n).(0) <- 0;
    let rec loop i x y =
        if i = m then mat else
            let x = if s.[i] = 'L' then x - 1 else if s.[i] = 'R' then x + 1 else x in
            let y = if s.[i] = 'D' then y + 1 else if s.[i] = 'U' then y - 1 else y in
            let () = mat.(y).(x) <- 0 in
            loop (i + 1) x y
    in
    Array.iter (fun a ->
        Array.iter (Printf.printf "%d ") a; print_newline ()
            ) @@ loop 0 0 n 

)
0