結果

問題 No.9 モンスターのレベル上げ
ユーザー aimyaimy
提出日時 2017-05-04 10:22:41
言語 Haskell
(9.8.2)
結果
WA  
実行時間 -
コード長 446 bytes
コンパイル時間 5,068 ms
コンパイル使用メモリ 160,356 KB
実行使用メモリ 13,560 KB
最終ジャッジ日時 2023-10-12 07:44:12
合計ジャッジ時間 18,345 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,628 KB
testcase_01 AC 3 ms
7,592 KB
testcase_02 AC 1,442 ms
13,388 KB
testcase_03 WA -
testcase_04 AC 582 ms
12,588 KB
testcase_05 AC 382 ms
12,296 KB
testcase_06 AC 132 ms
11,924 KB
testcase_07 AC 7 ms
11,684 KB
testcase_08 AC 182 ms
11,996 KB
testcase_09 AC 1,382 ms
13,332 KB
testcase_10 AC 3 ms
7,516 KB
testcase_11 AC 1,231 ms
13,560 KB
testcase_12 AC 1,312 ms
12,884 KB
testcase_13 WA -
testcase_14 AC 1,392 ms
13,276 KB
testcase_15 AC 1,272 ms
13,272 KB
testcase_16 WA -
testcase_17 AC 822 ms
12,728 KB
testcase_18 AC 682 ms
12,528 KB
testcase_19 AC 22 ms
11,812 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.6.1/environments/default
[1 of 2] Compiling Main             ( Main.hs, Main.o )
[2 of 2] Linking a.out

ソースコード

diff #

import qualified Data.Set as S
import Data.List
import Data.Ord

fork f g (x,y) = (f x, g y)

main = do
 n <- readLn
 as <- map read . words <$> getLine
 bs <- map read . words <$> getLine
 let q = S.fromList (zip as (repeat 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
0