Submission #30018764
Source Code Expand
// [start, stop]の範囲で、cond x がtrueとなる最小のxを求める // [start, stop]の範囲全てが満たす場合はstart-1, 全てが満たさない場合はstop+1 let lowerBound start stop cond = let left = start - 1 let right = stop + 1 let rec loop left right = // eprintfn "%d %d" left right if right - left <= 1 then right else let mid = left + (right - left) / 2 if cond mid then loop left mid else loop mid right loop left right #nowarn "25" let getStr () = stdin.ReadLine() let getInt () = stdin.ReadLine() |> int let getInts () = stdin.ReadLine().Split() |> Array.map int let N = getInt() let A = getInts() |> Array.sort let B = getInts() let C = getInts() |> Array.sort let checkBA ib ia = B.[ib] > A.[ia] let checkBC ib ic = C.[ic] > B.[ib] seq { for ib in 0..(N-1) do let ia = lowerBound 0 (N-1) (fun ia -> A.[ia] >= B.[ib]) |> int64 let ic = N - (lowerBound 0 (N-1) (fun ic -> B.[ib] < C.[ic])) |> int64 yield ia * ic } |> Seq.sum |> printfn "%d"
Submission Info
Submission Time | |
---|---|
Task | C - Snuke Festival |
User | maesora |
Language | F# (.NET Core 3.1.201) |
Score | 300 |
Code Size | 1136 Byte |
Status | AC |
Exec Time | 259 ms |
Memory | 66340 KiB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | s1.txt, s2.txt, s3.txt |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt, 29.txt, s1.txt, s2.txt, s3.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | AC | 259 ms | 49160 KiB |
02.txt | AC | 243 ms | 49316 KiB |
03.txt | AC | 222 ms | 45488 KiB |
04.txt | AC | 226 ms | 45352 KiB |
05.txt | AC | 219 ms | 43436 KiB |
06.txt | AC | 223 ms | 43296 KiB |
07.txt | AC | 203 ms | 47272 KiB |
08.txt | AC | 203 ms | 47280 KiB |
09.txt | AC | 194 ms | 45684 KiB |
10.txt | AC | 200 ms | 45720 KiB |
11.txt | AC | 178 ms | 45332 KiB |
12.txt | AC | 175 ms | 45368 KiB |
13.txt | AC | 238 ms | 49196 KiB |
14.txt | AC | 214 ms | 49140 KiB |
15.txt | AC | 213 ms | 49416 KiB |
16.txt | AC | 214 ms | 49460 KiB |
17.txt | AC | 216 ms | 51356 KiB |
18.txt | AC | 214 ms | 51548 KiB |
19.txt | AC | 237 ms | 49368 KiB |
20.txt | AC | 184 ms | 45548 KiB |
21.txt | AC | 181 ms | 45356 KiB |
22.txt | AC | 213 ms | 66340 KiB |
23.txt | AC | 224 ms | 49472 KiB |
24.txt | AC | 231 ms | 49316 KiB |
25.txt | AC | 225 ms | 49420 KiB |
26.txt | AC | 98 ms | 29612 KiB |
27.txt | AC | 101 ms | 29844 KiB |
28.txt | AC | 100 ms | 29876 KiB |
29.txt | AC | 110 ms | 29628 KiB |
s1.txt | AC | 101 ms | 29676 KiB |
s2.txt | AC | 98 ms | 29960 KiB |
s3.txt | AC | 101 ms | 29780 KiB |