結果

問題 No.146 試験監督(1)
コンテスト
ユーザー Kaito Udagawa
提出日時 2015-02-09 00:05:51
言語 Haskell
(9.14.1)
コンパイル:
ghc -rtsopts -with-rtsopts=-K1G -o a.out -O2 _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 567 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 4,743 ms
コンパイル使用メモリ 207,960 KB
実行使用メモリ 18,756 KB
最終ジャッジ日時 2026-03-08 01:42:27
合計ジャッジ時間 5,270 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 3
権限があれば一括ダウンロードができます
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.14.1/environments/default
[1 of 2] Compiling Main             ( Main.hs, Main.o )
[2 of 2] Linking a.out

ソースコード

diff #
raw source code

import Data.Functor
import Control.Monad
import qualified Data.ByteString.Char8 as B
import Data.Maybe

countExaminee :: [[Int]] -> Int
countExaminee (_:xs) = count xs `mod` 1000000007
  where
    count :: [[Int]] -> Int
    count [] = 0
    count ((c:d:_):xs) = ((c' + 1) `div` 2) * d' + count xs
      where
        c' = c `mod` 1000000007
        d' = d `mod` 1000000007

readInts :: B.ByteString -> [Int]
readInts s = fst <$> mapMaybe (B.readInt) (B.words s)

main :: IO ()
main = countExaminee <$> (readInts <$>) <$> B.lines <$> B.getContents >>= putStrLn . show
0