結果

問題 No.146 試験監督(1)
ユーザー taktak
提出日時 2019-02-13 14:32:13
言語 F#
(F# 4.0)
結果
WA  
実行時間 -
コード長 629 bytes
コンパイル時間 9,329 ms
コンパイル使用メモリ 187,680 KB
実行使用メモリ 59,268 KB
最終ジャッジ日時 2024-09-13 09:58:10
合計ジャッジ時間 10,654 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (264 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

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