結果

問題 No.91 赤、緑、青の石
ユーザー guriceringuricerin
提出日時 2020-02-25 10:48:37
言語 F#
(F# 4.0)
結果
AC  
実行時間 1,231 ms / 5,000 ms
コード長 1,661 bytes
コンパイル時間 5,011 ms
コンパイル使用メモリ 164,436 KB
実行使用メモリ 28,636 KB
最終ジャッジ日時 2023-09-06 12:47:49
合計ジャッジ時間 19,893 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 838 ms
24,552 KB
testcase_01 AC 554 ms
28,608 KB
testcase_02 AC 376 ms
28,512 KB
testcase_03 AC 655 ms
28,552 KB
testcase_04 AC 350 ms
26,420 KB
testcase_05 AC 762 ms
28,624 KB
testcase_06 AC 192 ms
26,616 KB
testcase_07 AC 63 ms
22,524 KB
testcase_08 AC 63 ms
24,404 KB
testcase_09 AC 62 ms
22,408 KB
testcase_10 AC 65 ms
22,520 KB
testcase_11 AC 292 ms
28,636 KB
testcase_12 AC 817 ms
28,588 KB
testcase_13 AC 871 ms
28,596 KB
testcase_14 AC 557 ms
26,716 KB
testcase_15 AC 792 ms
26,508 KB
testcase_16 AC 61 ms
24,400 KB
testcase_17 AC 61 ms
24,456 KB
testcase_18 AC 61 ms
22,440 KB
testcase_19 AC 58 ms
22,324 KB
testcase_20 AC 57 ms
20,596 KB
testcase_21 AC 59 ms
24,516 KB
testcase_22 AC 60 ms
22,444 KB
testcase_23 AC 61 ms
22,416 KB
testcase_24 AC 59 ms
20,308 KB
testcase_25 AC 1,205 ms
26,560 KB
testcase_26 AC 1,123 ms
26,740 KB
testcase_27 AC 62 ms
22,424 KB
testcase_28 AC 109 ms
28,572 KB
testcase_29 AC 168 ms
26,484 KB
testcase_30 AC 917 ms
26,600 KB
testcase_31 AC 1,231 ms
26,548 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

/home/judge/data/code/Main.fs(28,13): warning FS0025: Incomplete pattern matches on this expression. For example, the value '[_;_;_;_]' may indicate a case not covered by the pattern(s).

ソースコード

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 ls = reada int
    let nin = Array.min ls
    let ls = Array.map (fun x -> x - nin) ls |> List.ofArray

    let rec loop ls acc =
        let [ x; y; z ] = List.sort ls
        match x, y, z with
        | 0, 0, z when z < 5 -> acc
        | 0, 0, z when z >= 5 ->
            loop
                [ x
                  y
                  z - 5 ] (acc + 1)
        | 0, 1, z when z <= 2 -> acc
        | 0, 2, z when z <= 2 -> acc
        | 0, _, z when z > 2 ->
            loop
                [ x
                  y - 1
                  z - 3 ] (acc + 1)
        | _ ->
            loop
                [ x - 1
                  y - 1
                  z - 1 ] (acc + 1)

    let ans = nin + (loop ls 0)
    ans |> puts
    ()

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