AtCoder Regular Contest 036

Submission #3374979

Source codeソースコード

let m = 1000000007
let ( +^ ) x y = (x + y) mod m

let () = Scanf.scanf "%d %d\n%s" @@ fun n k s ->
  let dp = Array.init (n + 1) @@ fun _ -> Array.make_matrix (k + 2) (k + 2) 0 in
  dp.(0).(k).(1) <- 1;
  String.iteri (fun i -> function
    | '0' ->
        for l = -k + 1 to 1 do
          for r = -1 to k do
            dp.(i + 1).(min 0 l - 1 + k).(max 0 r) <- dp.(i).(l + k).(r + 1) +^ dp.(i + 1).(min 0 l - 1 + k).(max 0 r);
          done
        done
    | '1' ->
        for l = -k to 1 do
          for r = -1 to k - 1 do
            dp.(i + 1).(min 0 l + 1 + k).(max 0 r + 2) <- dp.(i).(l + k).(r + 1) +^ dp.(i + 1).(min 0 l + 1 + k).(max 0 r + 2)
          done
        done
    | '?' ->
        for l = -k + 1 to 1 do
          for r = -1 to k do
            dp.(i + 1).(min 0 l - 1 + k).(max 0 r) <- dp.(i).(l + k).(r + 1) +^ dp.(i + 1).(min 0 l - 1 + k).(max 0 r);
          done
        done;
        for l = -k to 1 do
          for r = -1 to k - 1 do
            dp.(i + 1).(min 0 l + 1 + k).(max 0 r + 2) <- dp.(i).(l + k).(r + 1) +^ dp.(i + 1).(min 0 l + 1 + k).(max 0 r + 2)
          done
        done) s;
  Printf.printf "%d\n" @@ Array.fold_left (Array.fold_left ( +^ )) 0 dp.(n)

Submission

Task問題 C - 偶然ジェネレータ
User nameユーザ名 fetburner
Created time投稿日時
Language言語 OCaml (4.02.3)
Status状態 TLE
Score得点 40
Source lengthソースコード長 1235 Byte
File nameファイル名
Exec time実行時間 ms
Memory usageメモリ使用量 -

Compiler messageコンパイルメッセージ

File "./Main.ml", line 7, characters 25-942:
Warning 8: this pattern-matching is not exhaustive.
Here is an example of a value that is not matched:
'a'

Test case

Set

Set name Score得点 / Max score Cases
Sample - subtask0-sample-01.txt,subtask0-sample-02.txt,subtask0-sample-03.txt,subtask0-sample-04.txt
Subtask1 10 / 10 subtask0-sample-01.txt,subtask0-sample-02.txt,subtask0-sample-03.txt,subtask0-sample-04.txt,subtask1-01.txt,subtask1-02.txt,subtask1-03.txt,subtask1-04.txt,subtask1-05.txt,subtask1-06.txt,subtask1-07.txt,subtask1-08.txt,subtask1-09.txt,subtask1-10.txt
Subtask2 30 / 30 subtask0-sample-01.txt,subtask0-sample-02.txt,subtask0-sample-03.txt,subtask0-sample-04.txt,subtask2-01.txt,subtask2-02.txt,subtask2-03.txt,subtask2-04.txt,subtask2-05.txt,subtask2-06.txt,subtask2-07.txt,subtask2-08.txt,subtask2-09.txt,subtask2-10.txt
Subtask3 0 / 60 subtask0-sample-01.txt,subtask0-sample-02.txt,subtask0-sample-03.txt,subtask0-sample-04.txt,subtask1-01.txt,subtask1-02.txt,subtask1-03.txt,subtask1-04.txt,subtask1-05.txt,subtask1-06.txt,subtask1-07.txt,subtask1-08.txt,subtask1-09.txt,subtask1-10.txt,subtask2-01.txt,subtask2-02.txt,subtask2-03.txt,subtask2-04.txt,subtask2-05.txt,subtask2-06.txt,subtask2-07.txt,subtask2-08.txt,subtask2-09.txt,subtask2-10.txt,subtask3-01.txt,subtask3-02.txt,subtask3-03.txt,subtask3-04.txt,subtask3-05.txt,subtask3-06.txt,subtask3-07.txt,subtask3-08.txt,subtask3-09.txt,subtask3-10.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
subtask0-sample-01.txt AC 1 ms 384 KB
subtask0-sample-02.txt AC 1 ms 384 KB
subtask0-sample-03.txt AC 1 ms 384 KB
subtask0-sample-04.txt AC 1 ms 384 KB
subtask1-01.txt AC 1 ms 384 KB
subtask1-02.txt AC 1 ms 384 KB
subtask1-03.txt AC 1 ms 384 KB
subtask1-04.txt AC 1 ms 384 KB
subtask1-05.txt AC 1 ms 384 KB
subtask1-06.txt AC 1 ms 384 KB
subtask1-07.txt AC 1 ms 384 KB
subtask1-08.txt AC 1 ms 384 KB
subtask1-09.txt AC 1 ms 384 KB
subtask1-10.txt AC 1 ms 384 KB
subtask2-01.txt AC 1 ms 384 KB
subtask2-02.txt AC 1 ms 384 KB
subtask2-03.txt AC 2 ms 640 KB
subtask2-04.txt AC 2 ms 640 KB
subtask2-05.txt AC 2 ms 640 KB
subtask2-06.txt AC 2 ms 640 KB
subtask2-07.txt AC 2 ms 640 KB
subtask2-08.txt AC 2 ms 640 KB
subtask2-09.txt AC 2 ms 640 KB
subtask2-10.txt AC 2 ms 640 KB
subtask3-01.txt AC 9 ms 1408 KB
subtask3-02.txt AC 38 ms 6656 KB
subtask3-03.txt AC 4 ms 768 KB
subtask3-04.txt AC 7 ms 1280 KB
subtask3-05.txt AC 20 ms 4864 KB
subtask3-06.txt AC 35 ms 4608 KB
subtask3-07.txt TLE
subtask3-08.txt AC 4 ms 768 KB
subtask3-09.txt AC 5 ms 1024 KB
subtask3-10.txt AC 11 ms 1536 KB