結果

問題 No.483 マッチ並べ
ユーザー ichibanshiboriichibanshibori
提出日時 2017-02-11 00:35:40
言語 F#
(F# 4.0)
結果
TLE  
実行時間 -
コード長 1,461 bytes
コンパイル時間 5,121 ms
コンパイル使用メモリ 162,072 KB
実行使用メモリ 27,264 KB
最終ジャッジ日時 2023-08-28 12:32:58
合計ジャッジ時間 12,587 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 96 ms
25,232 KB
testcase_01 AC 95 ms
23,240 KB
testcase_02 AC 95 ms
23,216 KB
testcase_03 AC 97 ms
23,236 KB
testcase_04 AC 99 ms
23,244 KB
testcase_05 AC 96 ms
25,204 KB
testcase_06 AC 96 ms
23,268 KB
testcase_07 AC 97 ms
23,220 KB
testcase_08 AC 96 ms
23,220 KB
testcase_09 AC 96 ms
23,272 KB
testcase_10 AC 96 ms
21,232 KB
testcase_11 AC 97 ms
23,332 KB
testcase_12 AC 96 ms
23,332 KB
testcase_13 AC 99 ms
25,220 KB
testcase_14 AC 100 ms
23,256 KB
testcase_15 AC 98 ms
23,116 KB
testcase_16 AC 99 ms
25,228 KB
testcase_17 AC 98 ms
25,216 KB
testcase_18 AC 90 ms
22,960 KB
testcase_19 AC 98 ms
23,160 KB
testcase_20 AC 98 ms
23,100 KB
testcase_21 AC 97 ms
23,288 KB
testcase_22 AC 98 ms
23,220 KB
testcase_23 AC 98 ms
25,208 KB
testcase_24 AC 97 ms
23,256 KB
testcase_25 AC 97 ms
23,240 KB
testcase_26 AC 102 ms
27,264 KB
testcase_27 AC 98 ms
23,368 KB
testcase_28 AC 99 ms
25,228 KB
testcase_29 AC 99 ms
23,296 KB
testcase_30 TLE -
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 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
testcase_55 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

ソースコード

diff #

let solve rc_lst =
    let rec solve' lst (result: Set<int * int> list) =
        //eprintfn "%A" result

        match lst with
        | [] -> true
        | x::xs ->
            let r0, c0, r1, c1 = x
            let result = match result with
                         | [] -> [set[(r0, c0)]; set[(r1, c1)]]
                         | _ ->
                            result
                            |> List.map (fun s ->
                                match (Set.contains (r0, c0) s), (Set.contains (r1, c1) s) with
                                | true, true -> []
                                | false, true -> [(Set.add (r0, c0) s)]
                                | true, false -> [(Set.add (r1, c1) s)]
                                | false, false -> [(Set.add (r0, c0) s); (Set.add (r1, c1) s)])
                            |> List.concat
            if result = [] then false
            else solve' xs result

    solve' rc_lst []

let () =
    let n = stdin.ReadLine() |> int

    let rc_lst =
        seq {
            for _ in 1..n do
                let r0, c0, r1, c1 = stdin.ReadLine()
                                     |> fun s -> s.Split()
                                     |> Array.map int
                                     |> fun arr -> arr.[0], arr.[1], arr.[2], arr.[3]
                yield (r0, c0, r1, c1) }
        |> List.ofSeq

    solve rc_lst
    |> function | true -> "YES" | false -> "NO"
    |> printfn "%s"
0