結果
| 問題 | No.11 カードマッチ | 
| コンテスト | |
| ユーザー |  情報学生 | 
| 提出日時 | 2019-08-27 00:07:43 | 
| 言語 | Haskell (9.10.1) | 
| 結果 | 
                                CE
                                 
                            (最新) 
                                AC
                                 
                            (最初) | 
| 実行時間 | - | 
| コード長 | 954 bytes | 
| コンパイル時間 | 170 ms | 
| コンパイル使用メモリ | 151,168 KB | 
| 最終ジャッジ日時 | 2024-11-15 04:48:24 | 
| 合計ジャッジ時間 | 728 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge4 | 
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、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:10:1: error: [GHC-87110]
    Could not load module ‘Data.IntSet’.
    It is a member of the hidden package ‘containers-0.6.8’.
    Use -v to see a list of the files searched for.
   |
10 | import Data.IntSet (IntSet)
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
Main.hs:11:1: error: [GHC-87110]
    Could not load module ‘Data.IntSet’.
    It is a member of the hidden package ‘containers-0.6.8’.
    Use -v to see a list of the files searched for.
   |
11 | import qualified Data.IntSet as ISet
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            
            ソースコード
import Control.Applicative ((<$>))
import Control.Monad (replicateM)
import Data.Bits (xor)
import Data.ByteString.Char8 (ByteString)
import qualified Data.ByteString.Char8 as B
import Data.Char (isSpace)
import Data.IntSet (IntSet)
import qualified Data.IntSet as ISet
import Data.List (foldl', unfoldr, nub)
getL :: (ByteString -> [Int]) -> IO [Int]
getL f = f <$> B.getLine
readIL :: (ByteString -> Maybe (Int, ByteString)) -> (ByteString -> [Int])
readIL f = unfoldr g
    where
        g s = do
            (n, s') <- f s
            return (n, B.dropWhile isSpace s')
main :: IO ()
main = do
    w <- readLn :: IO Int
    h <- readLn :: IO Int
    n <- readLn :: IO Int
    xss <- replicateM n $ getL (readIL B.readInt)
    print $ solve w h n xss
solve :: Int -> Int -> Int -> [[Int]] -> Int
solve w h n xss = xs * h + ys * w - xs * ys - n
    where
        xs = length $ nub $ map head xss
        ys = length $ nub $ map (head.tail) xss
            
            
            
        