結果

問題 No.146 試験監督(1)
ユーザー taktak
提出日時 2019-02-13 15:07:52
言語 F#
(F# 4.0)
結果
AC  
実行時間 323 ms / 1,000 ms
コード長 649 bytes
コンパイル時間 4,040 ms
コンパイル使用メモリ 154,656 KB
実行使用メモリ 53,716 KB
最終ジャッジ日時 2023-10-11 11:13:56
合計ジャッジ時間 5,475 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

let MOD = pown 10 9 |> (+)7 |> int64
let R() = stdin.ReadLine()

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