結果

問題 No.146 試験監督(1)
ユーザー taktak
提出日時 2019-02-13 14:32:13
言語 F#
(F# 4.0)
結果
WA  
実行時間 -
コード長 629 bytes
コンパイル時間 3,444 ms
コンパイル使用メモリ 160,324 KB
実行使用メモリ 43,528 KB
最終ジャッジ日時 2023-10-11 11:12:10
合計ジャッジ時間 5,545 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

ソースコード

diff #

[<Literal>]
let MOD = 1000000007L
let (|ODD|EVE|) x = if x%2L=0L then EVE else ODD

let R() = stdin.ReadLine()

let solve cs ds =
    let rec f score cs ds =
        match cs, ds with
        | [], _ | _, [] -> score
        | c::cs, d::ds ->
            match c with
            | EVE -> f ((score+(c/2L)*d)%MOD) cs ds
            | ODD -> f ((score+(c/2L+1L)*d)%MOD) cs ds 
    f 0L cs ds
    
let N = R() |> int
let C, D =
    let t = List.init N (fun _ ->
        let t = R().Split()
        int64 t.[0], int64 t.[1])
    let c = t |> List.map fst
    let d = t |> List.map snd
    c, d
       
solve C D
|> stdout.WriteLine
0