結果

問題 No.1679 マスゲーム
ユーザー ichibanshiboriichibanshibori
提出日時 2021-09-29 22:28:33
言語 F#
(F# 4.0)
結果
TLE  
実行時間 -
コード長 696 bytes
コンパイル時間 7,029 ms
コンパイル使用メモリ 155,556 KB
実行使用メモリ 25,100 KB
最終ジャッジ日時 2023-09-23 17:58:13
合計ジャッジ時間 13,550 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 95 ms
25,100 KB
testcase_01 AC 96 ms
23,148 KB
testcase_02 AC 97 ms
23,280 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 (a1, b1, t1) = abt1
    let (a2, b2, t2) = abt2

    if a1 = a2 then
        false
    else
        let g1 = t1 + b2
        let g2 = t2 + b1
        g1 = g2

let solve n (abtArr: (int * int * int) array) =
    seq {
        for i in 0 .. (n - 2) do
            for j in (i + 1) .. (n - 1) ->
                (abtArr.[i], abtArr.[j])
    }
    |> 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