結果

問題 No.647 明太子
ユーザー tak
提出日時 2018-03-31 00:15:21
言語 F#
(F# 4.0)
結果
RE  
実行時間 -
コード長 781 bytes
コンパイル時間 12,518 ms
コンパイル使用メモリ 195,216 KB
実行使用メモリ 129,344 KB
最終ジャッジ日時 2024-06-26 00:59:51
合計ジャッジ時間 20,329 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 RE * 1
other AC * 17 RE * 3
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (380 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

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
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