結果

問題 No.345 最小チワワ問題
ユーザー chike_pluschike_plus
提出日時 2020-03-18 07:36:53
言語 F#
(F# 4.0)
結果
WA  
実行時間 -
コード長 566 bytes
コンパイル時間 4,261 ms
コンパイル使用メモリ 156,288 KB
実行使用メモリ 26,904 KB
最終ジャッジ日時 2023-08-20 19:41:38
合計ジャッジ時間 7,307 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
24,056 KB
testcase_01 AC 50 ms
22,196 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 50 ms
22,068 KB
testcase_06 AC 50 ms
24,104 KB
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 AC 50 ms
22,196 KB
testcase_11 RE -
testcase_12 AC 51 ms
22,256 KB
testcase_13 RE -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 50 ms
24,228 KB
testcase_20 AC 49 ms
22,052 KB
testcase_21 AC 51 ms
24,180 KB
testcase_22 AC 51 ms
24,264 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 51 ms
22,124 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

ソースコード

diff #

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

  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) ->  t1 > n )
      |> function
        | Some (x1,x2)  -> x2 - n
        | None          -> -1
  )
  |> Seq.min
  |> stdout.WriteLine

``No.345 最小チワワ問題``()
0