結果

問題 No.179 塗り分け
ユーザー iwotiwot
提出日時 2020-06-21 15:32:13
言語 F#
(F# 4.0)
結果
WA  
実行時間 -
コード長 1,233 bytes
コンパイル時間 4,736 ms
コンパイル使用メモリ 159,416 KB
実行使用メモリ 42,548 KB
最終ジャッジ日時 2023-09-16 18:26:44
合計ジャッジ時間 12,525 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
29,112 KB
testcase_01 AC 80 ms
22,712 KB
testcase_02 AC 80 ms
22,668 KB
testcase_03 AC 81 ms
24,552 KB
testcase_04 AC 80 ms
22,648 KB
testcase_05 AC 1,638 ms
30,300 KB
testcase_06 AC 753 ms
26,736 KB
testcase_07 AC 77 ms
22,704 KB
testcase_08 AC 203 ms
26,792 KB
testcase_09 WA -
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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(21,9): warning FS0058: Possible incorrect indentation: this token is offside of context started at position (20:20). Try indenting this token further or using standard formatting conventions.

/home/judge/data/code/Main.fs(21,9): warning FS0058: Possible incorrect indentation: this token is offside of context started at position (20:20). Try indenting this token further or using standard formatting conventions.

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

ソースコード

diff #

let [| H; W |] = stdin.ReadLine().Split(' ') |> Array.map int
let S = [| for i in 1 .. H do
            let s = stdin.ReadLine().Trim()
            yield [| for j in 0 .. s.Length - 1 -> if s.[j] = '#' then 1 else 0 |] |]

let move h w moveh movew (ss:int[][]) = 
    if h+moveh < H && w+movew < W && ss.[h].[w] = 1 && ss.[h+moveh].[w+movew] = 1 then
        [| for hi in 0 .. H - 1 ->
            [| for wi in 0 .. W - 1 do
                if hi = h && wi = w then yield 0
                else if hi = h+moveh && wi = w+movew then yield 0
                else yield ss.[hi].[wi] |] |] |> Some
    else None

let isAll0 (ss:int[][]) =
    0 = Array.fold (fun acc sss -> acc + Array.sum sss) 0 ss

if isAll0 S then printfn "NO"
else
    let result = [ for moveh in 0 .. H - 1 do
        for movew in 0 .. W - 1 do
            if moveh > 0 || movew > 0 then
                let mutable ss = S
                for h in 0 .. H - 1 do
                    for w in 0 .. W - 1 do
                        match (move h w moveh movew ss) with
                        | Some (newss) -> ss <- newss
                        | None -> ()
                if isAll0 ss then yield 1 ]
    if List.sum result > 0 then printfn "YES" else printfn "NO"
0