結果
問題 | No.77 レンガのピラミッド |
ユーザー |
![]() |
提出日時 | 2017-05-03 11:00:44 |
言語 | Haskell (9.10.1) |
結果 |
AC
|
実行時間 | 2,687 ms / 5,000 ms |
コード長 | 401 bytes |
コンパイル時間 | 5,347 ms |
コンパイル使用メモリ | 169,856 KB |
実行使用メモリ | 36,352 KB |
最終ジャッジ日時 | 2024-09-14 07:02:28 |
合計ジャッジ時間 | 7,369 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 20 |
コンパイルメッセージ
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
ソースコード
import Data.List fork f (x,y) = (f x, f y) main = do n <- readLn as <- map read . words <$> getLine print (pyramid n as) pyramid n as = length ((ipos n as) \\ (ppos (sum as))) ipos n as = [(x,y) | x <- [0 .. n-1], y <- [0 .. (as!!x - 1)]] ppos x = last $ takeWhile ((<= x) . length) $ iterate shift [(0,0)] where shift ps = [(i,0) | i<-[0 .. (maximum (map fst ps) + 2)]] ++ map (fork succ) ps