結果
| 問題 |
No.647 明太子
|
| コンテスト | |
| ユーザー |
tak
|
| 提出日時 | 2018-03-31 00:19:00 |
| 言語 | F# (F# 4.0) |
| 結果 |
AC
|
| 実行時間 | 1,009 ms / 4,500 ms |
| コード長 | 841 bytes |
| コンパイル時間 | 13,496 ms |
| コンパイル使用メモリ | 196,120 KB |
| 実行使用メモリ | 129,724 KB |
| 最終ジャッジ日時 | 2024-06-27 02:54:43 |
| 合計ジャッジ時間 | 25,181 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 20 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.fsproj を復元しました (387 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/
ソースコード
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")
tak