結果
問題 |
No.345 最小チワワ問題
|
ユーザー |
![]() |
提出日時 | 2020-03-18 07:55:50 |
言語 | F# (F# 4.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 718 bytes |
コンパイル時間 | 7,187 ms |
コンパイル使用メモリ | 186,048 KB |
実行使用メモリ | 38,256 KB |
最終ジャッジ日時 | 2024-12-14 01:25:44 |
合計ジャッジ時間 | 11,201 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 23 RE * 6 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.fsproj を復元しました (241 ms)。 MSBuild のバージョン 17.9.6+a4ecab324 (.NET) main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
let ``No.345 最小チワワ問題``() = let s = stdin.ReadLine() let Windexes = s |> Seq.mapi (fun i c -> if c.Equals( 'w' ) then i + 1 else -1 ) |> Seq.filter (fun i -> i >= 0) |> Seq.pairwise let res = s |> Seq.mapi (fun i c -> if c.Equals( 'c' ) then i else -1 ) |> Seq.filter (fun i -> i >= 0) |> Seq.map ( fun n -> Windexes |> Seq.tryFind (fun (t1, t2) -> n < t1 ) |> function | Some (x1,x2) -> x2 - n | None -> -1 ) res |> Seq.max |> function | -1 -> -1 | _ -> res |> Seq.filter( fun n -> n > 0) |> Seq.min |> stdout.WriteLine ``No.345 最小チワワ問題``()