結果
| 問題 |
No.146 試験監督(1)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-01-22 16:15:02 |
| 言語 | Haskell (9.10.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 613 bytes |
| コンパイル時間 | 8,765 ms |
| コンパイル使用メモリ | 180,912 KB |
| 実行使用メモリ | 29,952 KB |
| 最終ジャッジ日時 | 2024-12-26 00:51:25 |
| 合計ジャッジ時間 | 6,965 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 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 Control.Applicative ((<$>))
import Control.Monad (replicateM)
import Data.List
import Data.Char (isSpace)
import Data.ByteString.Char8 (ByteString)
import qualified Data.ByteString.Char8 as B
main :: IO ()
main = do
n <- readLn
solve n <$> replicateM n readIntList >>= print
solve :: Int -> [[Int]] -> Int
solve n = foldl' f 0
where
m = 1000000007
f sn [c, d] = ((let c' = c `div` 2 in if even c then c' else c' + 1) * d + sn) `mod` m
readIntList :: IO [Int]
readIntList = unfoldr f <$> B.getLine
where
f s = do
(n, s') <- B.readInt s
return (n, B.dropWhile isSpace s')