結果

問題 No.146 試験監督(1)
コンテスト
ユーザー momen999
提出日時 2017-04-20 07:29:46
言語 Haskell
(9.14.1)
コンパイル:
ghc -rtsopts -with-rtsopts=-K1G -o a.out -O2 _filename_
実行:
./a.out
結果
MLE  
実行時間 -
コード長 614 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 5,299 ms
コンパイル使用メモリ 196,992 KB
実行使用メモリ 399,232 KB
最終ジャッジ日時 2026-04-02 17:57:50
合計ジャッジ時間 14,182 ms
ジャッジサーバーID
(参考情報)
judge5_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other TLE * 1 MLE * 2
権限があれば一括ダウンロードができます
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.14.1/environments/default
[1 of 2] Compiling Main             ( Main.hs, Main.o )
Main.hs:23:14: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from Data.List, but defined in GHC.Internal.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching, 'Data.List.uncons' or 'Data.Maybe.listToMaybe' instead. Consider refactoring to use "Data.List.NonEmpty"."
   |
23 |         c = [head x | x <- cd]
   |              ^^^^

[2 of 2] Linking a.out

ソースコード

diff #
raw source code

import Control.Monad
import Data.List


checkMax :: (Integral a) => [a] -> [a] -> a
checkMax cs ds = foldr ((+) . modm) 0 $ map modm $ zipWith (*) cs ds
modm a = a `mod` (10^9 + 7)

checkChair :: (Integral a) => a -> a
checkChair c
    | even c == True    = ce
    | odd c == True     = co
    | otherwise         = 0
    where
        ce = div c 2
        co = div c 2 + 1

main = do
    n <- readLn
    str <- replicateM n getLine
    let
        cd = map (map read . words) str :: [[Integer]]
        c = [head x | x <- cd]
        c' = map checkChair c
        d = [last x | x <- cd]
    print $ checkMax c' d
0