結果
| 問題 |
No.452 横着者のビンゴゲーム
|
| コンテスト | |
| ユーザー |
okaduki
|
| 提出日時 | 2016-12-12 02:43:19 |
| 言語 | Haskell (9.10.1) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 1,237 bytes |
| コンパイル時間 | 4,782 ms |
| コンパイル使用メモリ | 149,376 KB |
| 最終ジャッジ日時 | 2024-11-29 13:19:48 |
| 合計ジャッジ時間 | 5,521 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.8.2/environments/default
[1 of 2] Compiling Main ( Main.hs, Main.o )
Main.hs:8:1: error: [GHC-87110]
Could not load module ‘Data.Set’.
It is a member of the hidden package ‘containers-0.6.8’.
Use -v to see a list of the files searched for.
|
8 | import qualified Data.Set as S
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ソースコード
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 qualified Data.Set as S
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 = S.fromList [arr!(m,y,x) | y <- [1..n]]
getRow arr n m y = S.fromList [arr!(m,y,x) | x <- [1..n]]
getDiag arr n m = [S.fromList [arr!(m,i,i) | i <- [1..n]], S.fromList [arr!(m,n+1-i,i) | i <- [1..n]]]
calc ss n m1 m2 = minimum [S.size (S.union s1 s2) |
s1 <- ss!m1,
s2 <- ss!m2]
build arr n m = [(i,xs) | i <- [1..m],
let xs = [getCol arr n i x | x <- [1..n]]
++ [getRow arr n i y | y <- [1..n]]
++ getDiag arr n i]
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 ss = array (1,m) $ build arr n m
let ans = minimum [calc ss n m1 m2 | m1 <- [1..m], m2 <- [m1+1..m]]
print $ ans-1
okaduki