結果

問題 No.9 モンスターのレベル上げ
ユーザー gigurururugigurururu
提出日時 2015-03-23 17:06:16
言語 Haskell
(9.8.2)
結果
WA  
実行時間 -
コード長 696 bytes
コンパイル時間 5,690 ms
コンパイル使用メモリ 162,872 KB
実行使用メモリ 13,624 KB
最終ジャッジ日時 2023-09-11 09:48:19
合計ジャッジ時間 17,382 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,556 KB
testcase_01 AC 3 ms
7,588 KB
testcase_02 AC 1,152 ms
13,612 KB
testcase_03 WA -
testcase_04 AC 462 ms
12,536 KB
testcase_05 AC 322 ms
12,272 KB
testcase_06 AC 82 ms
11,936 KB
testcase_07 AC 7 ms
11,684 KB
testcase_08 AC 132 ms
12,064 KB
testcase_09 AC 1,012 ms
13,604 KB
testcase_10 AC 2 ms
7,384 KB
testcase_11 AC 1,362 ms
13,544 KB
testcase_12 AC 1,362 ms
12,880 KB
testcase_13 WA -
testcase_14 AC 1,022 ms
13,536 KB
testcase_15 AC 1,023 ms
13,536 KB
testcase_16 WA -
testcase_17 AC 692 ms
13,624 KB
testcase_18 AC 572 ms
12,924 KB
testcase_19 AC 22 ms
11,836 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 Control.Applicative
import Control.Monad
import Data.Array
import Data.Maybe
import qualified Data.Set as S
import Debug.Trace

rotates s = f s $ reverse s
  where
    n = length s
    f xs []     = [xs]
    f xs (y:ys) = xs:f (take n (y:xs)) ys

main = do
  _ <- getLine
  a <- map read . words <$> getLine
  b <- map ((`div`2).read) . words <$> getLine
  let
    pq = foldl (flip S.insert) S.empty $ map (\i->(i,0)) a
    check m elevels =min m $ last . fst $ break (>m) $ map fst $ scanl f (0,pq) $ elevels
    f (mn,tpq) elevel = (max mn (cnt+1),S.insert (level+elevel,cnt+1) gotpq)
      where
        ((level,cnt),gotpq) = S.deleteFindMin tpq
  print $ foldl check (10^4) $ rotates b
0