結果

問題 No.846 メダル
ユーザー guriceringuricerin
提出日時 2020-02-03 09:03:24
言語 F#
(F# 4.0)
結果
AC  
実行時間 355 ms / 2,000 ms
コード長 1,609 bytes
コンパイル時間 11,548 ms
コンパイル使用メモリ 203,132 KB
実行使用メモリ 36,304 KB
最終ジャッジ日時 2023-10-19 01:41:04
合計ジャッジ時間 17,193 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 354 ms
35,804 KB
testcase_01 AC 63 ms
30,912 KB
testcase_02 AC 350 ms
36,284 KB
testcase_03 AC 352 ms
36,288 KB
testcase_04 AC 64 ms
30,912 KB
testcase_05 AC 63 ms
30,912 KB
testcase_06 AC 352 ms
35,952 KB
testcase_07 AC 63 ms
30,912 KB
testcase_08 AC 354 ms
35,952 KB
testcase_09 AC 351 ms
35,952 KB
testcase_10 AC 355 ms
35,952 KB
testcase_11 AC 352 ms
35,952 KB
testcase_12 AC 62 ms
30,912 KB
testcase_13 AC 62 ms
30,912 KB
testcase_14 AC 350 ms
36,304 KB
testcase_15 AC 63 ms
30,912 KB
testcase_16 AC 63 ms
30,912 KB
testcase_17 AC 352 ms
36,304 KB
testcase_18 AC 62 ms
30,912 KB
testcase_19 AC 62 ms
30,912 KB
testcase_20 AC 352 ms
36,304 KB
testcase_21 AC 349 ms
36,284 KB
testcase_22 AC 352 ms
35,804 KB
testcase_23 AC 62 ms
30,904 KB
testcase_24 AC 352 ms
36,228 KB
testcase_25 AC 351 ms
35,804 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (356 ms)。
MSBuild のバージョン 17.7.3+8ec440e68 (.NET)
/home/judge/data/code/Main.fs(35,9): warning FS0025: この式のパターン マッチが不完全です たとえば、値 '[|_; _; _; _|]' はパターンに含まれないケースを示す可能性があります。 [/home/judge/data/code/main.fsproj]
/home/judge/data/code/Main.fs(34,9): warning FS0025: この式のパターン マッチが不完全です たとえば、値 '[|_; _; _; _|]' はパターンに含まれないケースを示す可能性があります。 [/home/judge/data/code/main.fsproj]
  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

module Util =
    let strRev (s: string): string =
        s
        |> Seq.rev
        |> Seq.map string
        |> String.concat ""

    let inline roundup (x: ^a) (y: ^a): ^a =
        let one = LanguagePrimitives.GenericOne
        (x + y - one) / y

    let inline sameParity (x: ^a) (y: ^a): bool =
        let one = LanguagePrimitives.GenericOne
        (x &&& one) = (y &&& one)

let main() =
    let [| p; q; r |] = reada int64
    let [| a; b; c |] = reada int64

    // 天井関数
    // ceil x y = z のとき、以下が成り立つ
    // z - 1 < x/y <= z
    // (z - 1) * y < x <= z * y

    // 以下については、数直線を書いてみれば想像がつく
    let lower =
        List.max
            [ (a - 1L) * p + 1L
              (a + b - 1L) * q + 1L
              (a + b + c - 1L) * r + 1L ]

    let upper =
        List.min
            [ a * p
              (a + b) * q
              (a + b + c) * r ]

    if lower > upper then "-1" else sprintf "%d %d" lower upper
    |> puts
    ()

main()
writer.Close()
0