結果

問題 No.110 しましまピラミッド
ユーザー tottoripapertottoripaper
提出日時 2014-12-23 23:46:34
言語 Haskell
(9.10.1)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 494 bytes
コンパイル時間 2,098 ms
コンパイル使用メモリ 173,056 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-31 11:01:43
合計ジャッジ時間 3,207 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26
権限があれば一括ダウンロードができます
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.8.2/environments/default
[1 of 2] Compiling Main             ( Main.hs, Main.o )
[2 of 2] Linking a.out

ソースコード

diff #

import Control.Applicative
import Data.List (sort)

getInts :: IO [Int]
getInts = map read . words <$> getLine

main = do
  _ <- getLine
  ws <- sort <$> getInts
  _ <- getLine
  bs <- sort <$> getInts
  let
    f h _ 0 [] _ = h
    f h _ 1 _ [] = h
    f h pl 0 (w:rs) bs
      | w > pl = f (h+1) w 1 rs bs
      | otherwise = f h pl 0 rs bs
    f h pl 1 ws (b:rs)
      | b > pl = f (h+1) b 0 ws rs
      | otherwise = f h pl 1 ws rs
   in print $ max (f 0 (-1) 0 ws bs) (f 0 (-1) 1 ws bs)
  
0