結果

問題 No.1679 マスゲーム
ユーザー ichibanshiboriichibanshibori
提出日時 2021-09-29 22:38:25
言語 F#
(F# 4.0)
結果
TLE  
実行時間 -
コード長 751 bytes
コンパイル時間 8,458 ms
コンパイル使用メモリ 158,436 KB
実行使用メモリ 29,436 KB
最終ジャッジ日時 2023-09-23 18:07:35
合計ジャッジ時間 8,280 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 87 ms
29,436 KB
testcase_01 AC 88 ms
22,980 KB
testcase_02 AC 88 ms
23,012 KB
testcase_03 TLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

ソースコード

diff #

let isCollision (abt1, abt2) =
    let (_, b1, t1) = abt1
    let (_, b2, t2) = abt2
    let g1 = t1 + b2
    let g2 = t2 + b1
    g1 = g2

let solve n (abtArr: (int * int * int) array) =
    let (abtArr1, abtArr2) = Array.partition (fun (a1, _, _) -> a1 = 0) abtArr
    seq {
        for i in 1 .. (Array.length abtArr1) do
            for j in 1 .. (Array.length abtArr2) ->
                (abtArr1.[i - 1], abtArr2.[j - 1])
    }
    |> Seq.filter isCollision
    |> Seq.length

let () =
    let n = stdin.ReadLine() |> int
    let abtArr =
        seq {
            for i in 1 .. n ->
                stdin.ReadLine().Split() |> Array.map int |> fun arr -> (arr.[0], arr.[1], arr.[2])
        } |> Seq.toArray

    solve n abtArr |> printfn "%d"
0