結果

問題 No.799 赤黒かーどげぇむ
コンテスト
ユーザー tak
提出日時 2019-03-27 03:37:50
言語 F#
(F# 10.0)
コンパイル:
fsharp_c _filename_
実行:
/usr/bin/dotnet_wrap
結果
AC  
実行時間 47 ms / 2,000 ms
コード長 534 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 7,654 ms
コンパイル使用メモリ 200,260 KB
実行使用メモリ 32,676 KB
最終ジャッジ日時 2026-04-27 07:28:26
合計ジャッジ時間 7,460 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (178 ミリ秒)。
  main -> /home/judge/data/code/bin/Release/net10.0/main.dll
  main -> /home/judge/data/code/bin/Release/net10.0/publish/

ソースコード

diff #
raw source code

open System

let solve a b c d =
    let cdSet = [c .. d] |> Set.ofList
    let cdSetSize = d - c + 1 
    let cnts = [a .. b] |> Seq.countBy(fun x -> Set.contains x cdSet)
    let getCount flag = Seq.tryFind(fun (k, _) -> k = flag) >> Option.map snd >> Option.defaultValue 0
    let t1 = cnts |> getCount false 
    let t2 = cnts |> getCount true
    cdSetSize * t1 + (cdSetSize - 1) * t2
    
let a, b, c, d =
    let t = Console.ReadLine().Split() |> Array.map int
    t.[0], t.[1], t.[2], t.[3]

solve a b c d
|> Console.WriteLine
0