結果

問題 No.77 レンガのピラミッド
ユーザー aimyaimy
提出日時 2017-05-03 11:00:44
言語 Haskell
(9.8.2)
結果
AC  
実行時間 2,582 ms / 5,000 ms
コード長 401 bytes
コンパイル時間 755 ms
コンパイル使用メモリ 168,000 KB
実行使用メモリ 38,952 KB
最終ジャッジ日時 2023-10-12 07:54:17
合計ジャッジ時間 6,627 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,088 KB
testcase_01 AC 2 ms
7,064 KB
testcase_02 AC 3 ms
7,056 KB
testcase_03 AC 3 ms
6,988 KB
testcase_04 AC 2 ms
7,020 KB
testcase_05 AC 3 ms
7,040 KB
testcase_06 AC 2,582 ms
38,952 KB
testcase_07 AC 3 ms
7,052 KB
testcase_08 AC 402 ms
21,780 KB
testcase_09 AC 62 ms
14,032 KB
testcase_10 AC 42 ms
14,024 KB
testcase_11 AC 52 ms
14,056 KB
testcase_12 AC 182 ms
16,940 KB
testcase_13 AC 173 ms
16,512 KB
testcase_14 AC 232 ms
19,296 KB
testcase_15 AC 42 ms
13,800 KB
testcase_16 AC 32 ms
13,304 KB
testcase_17 AC 12 ms
11,304 KB
testcase_18 AC 212 ms
17,936 KB
testcase_19 AC 4 ms
8,624 KB
testcase_20 AC 4 ms
9,640 KB
testcase_21 AC 102 ms
15,180 KB
testcase_22 AC 42 ms
14,052 KB
testcase_23 AC 92 ms
14,816 KB
testcase_24 AC 3 ms
7,132 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 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
0