結果
問題 | No.24 数当てゲーム |
ユーザー | 情報学生 |
提出日時 | 2019-08-14 22:45:09 |
言語 | Haskell (9.8.2) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 614 bytes |
コンパイル時間 | 218 ms |
コンパイル使用メモリ | 142,556 KB |
最終ジャッジ日時 | 2023-10-19 18:16:26 |
合計ジャッジ時間 | 692 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、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:1:1: error: Could not load module ‘Data.Set’ It is a member of the hidden package ‘containers-0.6.7’. You can run ‘:set -package containers’ 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. | 1 | import qualified Data.Set as S | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ソースコード
import qualified Data.Set as S splitEvery5 :: [String] -> [[String]] splitEvery5 = takeWhile (not . null) . map (take 5) . iterate (drop 5) main :: IO () main = interact $ solve . splitEvery5 . tail . words solve :: [[String]] -> String solve xss = if null (filter (\xs -> "YES" == last xs) xss) then head $ S.toList ((S.fromList $ map show [0..9]) S.\\ noss) else head . S.toList $ yess S.\\ noss where yess = foldr1 S.intersection $ map S.fromList $ map init $ filter (\xs -> "YES" == last xs) xss noss = S.fromList . concat $ map init $ filter (\xs -> "NO" == last xs) xss