結果

問題 No.893 お客様を誘導せよ
ユーザー 情報学生情報学生
提出日時 2019-09-27 22:11:42
言語 Haskell
(9.8.2)
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 666 bytes
コンパイル時間 437 ms
コンパイル使用メモリ 142,292 KB
最終ジャッジ日時 2023-10-24 20:57:50
合計ジャッジ時間 777 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.6.2/environments/default
[1 of 2] Compiling Main             ( Main.hs, Main.o )

Main.hs:5:1: error:
    Could not load module ‘Data.ByteString.Char8’
    It is a member of the hidden package ‘bytestring-0.11.4.0’.
    You can run ‘:set -package bytestring’ to expose it.
    (Note: this unloads all the modules in the current scope.)
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
  |
5 | import qualified Data.ByteString.Char8 as BSC8
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

ソースコード

diff #

--import Control.Applicative ((<$>))
import Control.Monad (replicateM)
import Data.Char (isSpace)
import Data.List (transpose, unfoldr)
import qualified Data.ByteString.Char8 as BSC8


getL :: (BSC8.ByteString -> [Int]) -> IO [Int]
getL f = f <$> BSC8.getLine

readIL :: (BSC8.ByteString -> Maybe (Int, BSC8.ByteString)) -> (BSC8.ByteString -> [Int])
readIL f = unfoldr g
    where
        g s = do
            (n, s') <- f s
            return (n, BSC8.dropWhile isSpace s')

main :: IO ()
main = do
    n <- readLn :: IO Int
    xss <- replicateM n $ getL (readIL BSC8.readInt)
    putStrLn $ unwords $ map show $ filter (/= 0) $ concat $ transpose $ map tail xss
0