結果

問題 No.647 明太子
ユーザー taktak
提出日時 2018-03-31 00:19:00
言語 F#
(F# 4.0)
結果
AC  
実行時間 838 ms / 4,500 ms
コード長 841 bytes
コンパイル時間 4,548 ms
コンパイル使用メモリ 160,032 KB
実行使用メモリ 123,636 KB
最終ジャッジ日時 2023-09-09 09:45:26
合計ジャッジ時間 9,446 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 92 ms
23,220 KB
testcase_01 AC 91 ms
25,124 KB
testcase_02 AC 91 ms
23,292 KB
testcase_03 AC 93 ms
21,080 KB
testcase_04 AC 90 ms
21,200 KB
testcase_05 AC 91 ms
23,072 KB
testcase_06 AC 91 ms
25,160 KB
testcase_07 AC 93 ms
25,260 KB
testcase_08 AC 92 ms
21,220 KB
testcase_09 AC 97 ms
25,256 KB
testcase_10 AC 102 ms
25,624 KB
testcase_11 AC 95 ms
23,444 KB
testcase_12 AC 99 ms
23,676 KB
testcase_13 AC 107 ms
24,228 KB
testcase_14 AC 247 ms
40,736 KB
testcase_15 AC 115 ms
26,472 KB
testcase_16 AC 98 ms
25,704 KB
testcase_17 AC 280 ms
42,624 KB
testcase_18 AC 293 ms
43,404 KB
testcase_19 AC 115 ms
27,820 KB
testcase_20 AC 112 ms
25,624 KB
testcase_21 AC 100 ms
23,520 KB
testcase_22 AC 838 ms
123,636 KB
testcase_23 AC 95 ms
25,444 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

ソースコード

diff #

open System

let read1() = Console.ReadLine() |> int
let read2() = let t = Console.ReadLine().Split() |> Array.map (int)
              in (t.[0],t.[1])

let N  = read1()
let AB = Array.init N (fun _ -> read2())
let M  = read1()
let XY = Array.init M (fun _ -> read2())
         |> Array.indexed
         |> Array.map (fun (idx,tup) -> (idx+1,tup))

let buy =  
    AB
    |> Array.map(fun (a,b) ->
        XY
        |> Array.where (fun (_,(x,y)) -> x<=a && b<=y)
        |> Array.map   (fun (idx,_) -> idx))
    |> Array.concat
    |> function
        | [||] -> [|0|]
        | x    -> x
let cnts = 
    buy 
    |> Array.countBy (fun x -> x)
let maxCnt = 
    cnts
    |> Array.maxBy (fun (_,cnt) -> cnt)
    |> snd
cnts
|> Array.where (fun (_,cnt) -> cnt=maxCnt)
|> Array.map   (fun (n,_) -> n)
|> Array.sort
|> Array.iter (printfn "%i")
0