結果
| 問題 |
No.146 試験監督(1)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-02-09 00:49:58 |
| 言語 | Haskell (9.10.1) |
| 結果 |
AC
|
| 実行時間 | 36 ms / 1,000 ms |
| コード長 | 608 bytes |
| コンパイル時間 | 8,282 ms |
| コンパイル使用メモリ | 181,032 KB |
| 実行使用メモリ | 16,128 KB |
| 最終ジャッジ日時 | 2024-06-23 10:31:26 |
| 合計ジャッジ時間 | 9,072 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 3 |
コンパイルメッセージ
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.Functor
import Control.Monad
import qualified Data.ByteString.Char8 as B
import Data.Maybe
import Debug.Trace
countExaminee :: [[Int]] -> Int
countExaminee (_:xs) = cir (count xs)
where
cir = (`mod` 1000000007)
count :: [[Int]] -> Int
count [] = 0
count ((c:d:_):xs) = v' + (cir (count xs))
where
c' = cir ((c + 1) `div` 2)
d' = cir d
v' = cir (c' * d')
readInts :: B.ByteString -> [Int]
readInts s = fst <$> mapMaybe (B.readInt) (B.words s)
main :: IO ()
main = countExaminee <$> (readInts <$>) <$> B.lines <$> B.getContents >>= putStrLn . show