結果
問題 | No.9 モンスターのレベル上げ |
ユーザー | aimy |
提出日時 | 2017-05-04 11:36:10 |
言語 | Haskell (9.8.2) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 476 bytes |
コンパイル時間 | 677 ms |
コンパイル使用メモリ | 143,232 KB |
最終ジャッジ日時 | 2023-11-10 22:15:56 |
合計ジャッジ時間 | 1,158 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge11 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、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 import Data.List import Data.Ord fork f g (x,y,z) = (f x, g y, z) snd' (_,y,_) = y main = do n <- readLn as <- map read . words <$> getLine bs <- map read . words <$> getLine let q = S.fromList (zip3 as (repeat 0) [0..]) print (levelup n q bs) levelup n q = minimum . take n . map (maximum . map snd' . S.elems . foldl hack q . take n) . tails . cycle hack q b = S.insert (fork (+ (div b 2)) (+1) m) q' where (m,q') = S.deleteFindMin q