結果

問題 No.647 明太子
ユーザー ichibanshiboriichibanshibori
提出日時 2018-09-20 00:26:59
言語 F#
(F# 4.0)
結果
TLE  
実行時間 -
コード長 1,597 bytes
コンパイル時間 5,499 ms
コンパイル使用メモリ 159,924 KB
実行使用メモリ 411,040 KB
最終ジャッジ日時 2023-09-25 10:19:51
合計ジャッジ時間 25,517 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 176 ms
30,356 KB
testcase_01 AC 175 ms
29,568 KB
testcase_02 AC 122 ms
26,704 KB
testcase_03 AC 178 ms
28,272 KB
testcase_04 AC 178 ms
26,316 KB
testcase_05 AC 176 ms
28,236 KB
testcase_06 AC 176 ms
28,468 KB
testcase_07 AC 183 ms
32,368 KB
testcase_08 AC 182 ms
30,652 KB
testcase_09 AC 1,160 ms
68,420 KB
testcase_10 AC 2,843 ms
84,244 KB
testcase_11 AC 405 ms
74,776 KB
testcase_12 AC 1,661 ms
72,976 KB
testcase_13 TLE -
testcase_14 MLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

ソースコード

diff #

let solve abLst xyLst =
    let m = List.length xyLst

    let chooseLst =
        seq abLst
        |> Seq.map (fun (a, b) -> Seq.init m (fun i -> (a, b, xyLst.[i])))
        |> Seq.concat
        |> Seq.map
            (fun (a, b, (i, x, y)) ->
                async {
                    return
                        if (x <= a) && (y >= b) then
                            Some(i)
                        else
                            None
                })
        |> Async.Parallel
        |> Async.RunSynchronously
        |> Array.toSeq
        |> Seq.choose id
        |> Seq.countBy id
        |> Seq.sortBy (fun (i, iCnt) -> (-iCnt, i))
        |> Seq.toList

    if List.isEmpty chooseLst then
        stdout.WriteLine(0)
    else
        let maxCnt = List.map (fun (i, iCnt) -> iCnt) chooseLst |> List.max
        List.filter (fun (i, iCnt) -> iCnt = maxCnt) chooseLst
        |> List.iter (fun (i, iCnt) -> printfn "%A" i)

let () =
    let n = stdin.ReadLine() |> int
    let abLst =
        seq {
            for i in 1..n do
                let ab =
                    stdin.ReadLine()
                    |> fun s -> s.Split()
                    |> fun arr -> (int arr.[0], int arr.[1])
                yield ab }
        |> Seq.toList
    let m = stdin.ReadLine() |> int
    let xyLst =
        seq {
            for i in 1..m do
                let xy =
                    stdin.ReadLine()
                    |> fun s -> s.Split()
                    |> fun arr -> (i, int arr.[0], int arr.[1])
                yield xy }
        |> Seq.toList

    solve abLst xyLst
0