結果
問題 |
No.1133 キムワイプイーター
|
ユーザー |
|
提出日時 | 2020-08-15 13:44:49 |
言語 | OCaml (5.2.1) |
結果 |
AC
|
実行時間 | 32 ms / 2,000 ms |
コード長 | 536 bytes |
コンパイル時間 | 277 ms |
コンパイル使用メモリ | 21,448 KB |
実行使用メモリ | 7,720 KB |
最終ジャッジ日時 | 2024-10-09 02:00:21 |
合計ジャッジ時間 | 2,566 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 31 |
ソースコード
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 )