結果
| 問題 | 
                            No.1535 五七五
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2021-06-09 23:21:51 | 
| 言語 | OCaml  (5.2.1)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,527 bytes | 
| コンパイル時間 | 1,637 ms | 
| コンパイル使用メモリ | 19,840 KB | 
| 実行使用メモリ | 39,224 KB | 
| 最終ジャッジ日時 | 2024-11-29 00:55:45 | 
| 合計ジャッジ時間 | 28,612 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 12 TLE * 9 | 
ソースコード
module Cp : sig
  val string_1_list_of_string: string -> string list
  val split_on_char: char -> string -> string list
  val read_int_list: unit -> int list
end =
struct
  let string_1_list_of_string x =
    String.to_seq x
    |> List.of_seq
    |> List.map (String.make 1);;
  let split_on_char sep s =
    (* from OCaml Standard Library 4.12 *)
    let r = ref [] in
    let j = ref (String.length s) in
    for i = String.length s - 1 downto 0 do
      if String.unsafe_get s i = sep then begin
        r := String.sub s (i + 1) (!j - i - 1) :: !r;
        j := i
      end
    done;
    String.sub s 0 !j :: !r;;
  let read_int_list () =
    read_line () |> split_on_char ' ' |> List.map int_of_string;;
end
let rec puyopuyo lst abc =
  match abc with
  | [] -> true
  | hd::tl ->
    match lst with
    | [] -> false
    | lhd::_ when hd < String.length lhd -> false
    | lhd::ltl when hd = String.length lhd -> puyopuyo ltl tl
    | lhd::ltl when hd > String.length lhd ->
      puyopuyo ltl ((hd - (String.length lhd)) :: tl)
    | _ -> failwith "WTF !!!! ( o____o ) !!!!"
let rec solve lst abc result =
  match lst with
  | [] -> failwith "WTF!!!"
  | _ when List.length lst < 3 -> result
  | _::tl ->
    if (puyopuyo lst abc)
    then solve tl abc (result + 1)
    else solve tl abc result;;
let rec start lst abc = solve lst abc 0;;
let () =
  read_line () |> ignore;
  let abc = Cp.read_int_list () in
  let lst = Cp.split_on_char ' ' (read_line ()) in
  solve lst abc 0 |> print_int;
  print_newline ();;