結果

問題 No.110 しましまピラミッド
ユーザー guriceringuricerin
提出日時 2020-02-10 12:54:52
言語 F#
(F# 4.0)
結果
AC  
実行時間 68 ms / 5,000 ms
コード長 1,564 bytes
コンパイル時間 7,970 ms
コンパイル使用メモリ 194,468 KB
実行使用メモリ 31,412 KB
最終ジャッジ日時 2024-04-08 12:57:31
合計ジャッジ時間 10,858 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
31,412 KB
testcase_01 AC 66 ms
31,412 KB
testcase_02 AC 64 ms
31,028 KB
testcase_03 AC 64 ms
31,028 KB
testcase_04 AC 64 ms
31,028 KB
testcase_05 AC 68 ms
31,412 KB
testcase_06 AC 67 ms
31,412 KB
testcase_07 AC 67 ms
31,412 KB
testcase_08 AC 68 ms
31,412 KB
testcase_09 AC 67 ms
31,412 KB
testcase_10 AC 66 ms
31,412 KB
testcase_11 AC 66 ms
31,412 KB
testcase_12 AC 66 ms
31,412 KB
testcase_13 AC 66 ms
31,412 KB
testcase_14 AC 66 ms
31,412 KB
testcase_15 AC 67 ms
31,412 KB
testcase_16 AC 67 ms
31,412 KB
testcase_17 AC 67 ms
31,412 KB
testcase_18 AC 65 ms
31,028 KB
testcase_19 AC 68 ms
31,412 KB
testcase_20 AC 65 ms
31,028 KB
testcase_21 AC 68 ms
31,412 KB
testcase_22 AC 67 ms
31,412 KB
testcase_23 AC 66 ms
31,412 KB
testcase_24 AC 68 ms
31,412 KB
testcase_25 AC 67 ms
31,412 KB
testcase_26 AC 67 ms
31,412 KB
testcase_27 AC 67 ms
31,412 KB
testcase_28 AC 67 ms
31,412 KB
testcase_29 AC 66 ms
31,412 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (335 ms)。
MSBuild のバージョン 17.7.3+8ec440e68 (.NET)
  main -> /home/judge/data/code/bin/Release/net7.0/main.dll
  main -> /home/judge/data/code/bin/Release/net7.0/publish/

ソースコード

diff #

open System
open System.Collections.Generic

[<AutoOpen>]
module Cin =
    let read f = stdin.ReadLine() |> f
    let reada f = stdin.ReadLine().Split() |> Array.map f
    let readChars() = read string |> Seq.toArray
    let readInts() = readChars() |> Array.map (fun x -> Convert.ToInt32(x.ToString()))

[<AutoOpen>]
module Cout =
    let writer = new IO.StreamWriter(new IO.BufferedStream(Console.OpenStandardOutput()))
    let print (s: string) = writer.Write s
    let println (s: string) = writer.WriteLine s
    let inline puts (s: ^a) = string s |> println

// -----------------------------------------------------------------------------------------------------

// -----------------------------------------------------------------------------------------------------

let main() =
    let n = read int
    let ws = reada int |> Array.sortDescending
    let m = read int
    let bs = reada int |> Array.sortDescending
    let wbs = Array.zeroCreate 2
    wbs.[0] <- ws
    wbs.[1] <- bs

    let rec meguru cur target acc =
        let ano = (cur + 1) % 2
        let mutable ok, ng = wbs.[ano] |> Array.length, -1
        while abs (ok - ng) > 1 do
            let mid = (ok + ng) / 2
            if wbs.[ano].[mid] < target then ok <- mid else ng <- mid

        if ok <> Array.length wbs.[ano] then meguru ano wbs.[ano].[ok] (acc + 1) else acc

    let nax = max (meguru 0 ws.[0] 1) (meguru 1 bs.[0] 1)
    puts nax
    ()

// -----------------------------------------------------------------------------------------------------
main()
writer.Dispose()
0