結果

問題 No.146 試験監督(1)
ユーザー NaruYNaruY
提出日時 2018-02-15 21:01:45
言語 Haskell
(9.8.2)
結果
TLE  
実行時間 -
コード長 456 bytes
コンパイル時間 9,536 ms
コンパイル使用メモリ 162,660 KB
実行使用メモリ 201,912 KB
最終ジャッジ日時 2023-08-28 12:02:20
合計ジャッジ時間 15,275 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 TLE -
testcase_02 MLE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Monad
import Control.Applicative
import Data.List
import qualified Data.Map as Map
import Data.Array
strToInt s = (read :: String -> Int) s

main = do
    n <- readLn :: IO Int
    cd <- replicateM n (map read . words <$> getLine)
    print $ f cd
    
f :: [[Int]] -> Int
f [] = 0
f (a:an) = (f an) + (g (head a)) * (last a)
            where g x = if (even x)
                        then div x 2
                        else (div x 2) + 1
0