結果
問題 | No.1045 直方体大学 |
ユーザー | ikd |
提出日時 | 2020-05-03 02:05:46 |
言語 | F# (F# 4.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,608 bytes |
コンパイル時間 | 5,676 ms |
コンパイル使用メモリ | 176,032 KB |
実行使用メモリ | 57,608 KB |
最終ジャッジ日時 | 2023-08-30 17:50:50 |
合計ジャッジ時間 | 11,012 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 93 ms
32,336 KB |
testcase_01 | AC | 94 ms
25,280 KB |
testcase_02 | AC | 95 ms
25,140 KB |
testcase_03 | AC | 95 ms
23,232 KB |
testcase_04 | AC | 96 ms
25,288 KB |
testcase_05 | AC | 175 ms
27,264 KB |
testcase_06 | AC | 174 ms
29,464 KB |
testcase_07 | AC | 173 ms
27,316 KB |
testcase_08 | TLE | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
コンパイルメッセージ
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(14,9): warning FS0025: Incomplete pattern matches on this expression. For example, the value '[|_; _; _; _|]' may indicate a case not covered by the pattern(s).
ソースコード
// Learn more about F# at http://fsharp.org open System let max a b = if a > b then a else b type S = { A: int B: int C: int } let perm abc = let [| a; b; c |] = abc [| { A = a B = b C = c } { A = a B = c C = b } { A = b B = a C = c } { A = b B = c C = a } { A = c B = a C = b } { A = c B = b C = a } |] // x の上に y を置けるか let fit (x: S) (y: S) = x.A >= y.A && x.B >= y.B [<EntryPoint>] let main argv = let n = stdin.ReadLine() |> int let rects = [| for i in 1 .. n -> stdin.ReadLine().Split() |> Array.map int |] |> Array.map perm let mutable dp = Array3D.create (1 <<< n) n 6 -1 for i = 0 to (n - 1) do for j = 0 to 5 do dp.[1 <<< i, i, j] <- rects.[i].[j].C for (bits, i, j) in seq { for bits in 0 .. ((1 <<< n) - 1) do for i in 0 .. (n - 1) do for j in 0 .. 5 -> (bits, i, j) } do for k = 0 to (n - 1) do if ((bits >>> k) &&& 1) = 0 then for l = 0 to 5 do if fit rects.[i].[j] rects.[k].[l] then dp.[bits ^^^ (1 <<< k), k, l] <- max dp.[bits ^^^ (1 <<< k), k, l] (dp.[bits, i, j] + rects.[k].[l].C) dp |> Seq.cast |> Seq.max |> printfn "%d" 0 // return an integer exit code