結果

問題 No.548 国士無双
ユーザー LeonardoneLeonardone
提出日時 2017-07-29 00:35:39
言語 Haskell
(9.6.2)
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 541 bytes
コンパイル時間 4,411 ms
コンパイル使用メモリ 141,348 KB
最終ジャッジ日時 2023-10-17 16:02:05
合計ジャッジ時間 4,849 ms
ジャッジサーバーID
(参考情報)
judge11 / 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:4:1: error:
    Could not load module ‘Data.Map’
    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.
  |
4 | import qualified Data.Map as Map
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

ソースコード

diff #

-- Try yukicoder
-- author: Leonardone @ NEETSDKASU

import qualified Data.Map as Map

main = putStrLn . unlines . solve =<< getLine

hoge [] = ["Impossible"]
hoge xs = xs

solve xs = ans where
    xm = foldl f Map.empty xs
    f a x = Map.insertWith (+) x 1 a
    ans = hoge . map (return.fst) . filter h $ map g ['a' .. 'm']
    g c = (c, f xm c)
    h (c, m) = (13,14) == xx where
        xx = foldl u (0,0) ['a' .. 'm']
        u (a,b) x = case Map.lookup x m of
            Just k  -> (a+1,b+k)
            Nothing -> (0,0)
            
0