結果
問題 |
No.483 マッチ並べ
|
ユーザー |
|
提出日時 | 2017-02-11 00:35:40 |
言語 | F# (F# 4.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,461 bytes |
コンパイル時間 | 20,003 ms |
コンパイル使用メモリ | 207,424 KB |
実行使用メモリ | 267,712 KB |
最終ジャッジ日時 | 2024-12-29 11:31:18 |
合計ジャッジ時間 | 45,513 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 45 TLE * 8 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.fsproj を復元しました (832 ms)。 MSBuild のバージョン 17.9.6+a4ecab324 (.NET) main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
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"