結果

問題 No.452 横着者のビンゴゲーム
ユーザー okadukiokaduki
提出日時 2016-12-12 02:03:34
言語 Haskell
(9.8.2)
結果
WA  
実行時間 -
コード長 956 bytes
コンパイル時間 8,251 ms
コンパイル使用メモリ 180,312 KB
実行使用メモリ 13,764 KB
最終ジャッジ日時 2024-05-07 00:59:08
合計ジャッジ時間 13,773 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
13,764 KB
testcase_01 AC 1 ms
5,248 KB
testcase_02 AC 3 ms
5,248 KB
testcase_03 AC 15 ms
7,680 KB
testcase_04 AC 4 ms
5,888 KB
testcase_05 AC 18 ms
7,680 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 4 ms
6,400 KB
testcase_08 AC 9 ms
7,552 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 4 ms
5,888 KB
testcase_11 AC 8 ms
7,552 KB
testcase_12 AC 3 ms
5,376 KB
testcase_13 WA -
testcase_14 TLE -
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 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.8.2/environments/default
[1 of 2] Compiling Main             ( Main.hs, Main.o )
[2 of 2] Linking a.out

ソースコード

diff #

import Control.Applicative
import Control.Monad
import qualified Data.ByteString.Char8 as B
import Data.Maybe (fromJust)
import Data.Array
import Text.Printf
import Debug.Trace
import Data.List(union)

readInts :: B.ByteString -> [Int]
readInts = map (fst . fromJust . B.readInt) . B.words

getInts :: IO [Int]
getInts = liftM readInts B.getLine

getCol arr n m x = [arr!(m,y,x) | y <- [1..n]]
getRow arr n m y = [arr!(m,y,x) | x <- [1..n]]

calc arr n m1 m2 = minimum [length (union xs ys) | xs <- [getCol arr n m1 x | x <- [1..n]]++[getRow arr n m1 y | y <- [1..n]],
                            ys <- [getCol arr n m2 x | x <- [1..n]]++[getRow arr n m2 y | y <- [1..n]]]

main = do
  [n,m] <- getInts
  arr <- array ((1,1,1),(m,n,n)) <$> concat <$>
    forM [1..m] (\k -> concat <$>
                       forM [1..n] (\i -> zip [(k,i,j) | j <- [1..n]] <$> getInts))
  let ans = minimum [calc arr n m1 m2 | m1 <- [1..m], m2 <- [m1+1..m]]
  print $ ans-1
0