ocaml: phase 5.1 stock_two.ml baseline (best of 2 transactions = 6)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 23s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 23s
Two-pass partition DP for max profit with at most 2 transactions:
left[i] = max single-trans profit in prices[0..i]
(forward scan tracking running min)
right[i] = max single-trans profit in prices[i..n-1]
(backward scan tracking running max)
answer = max over i of (left[i] + right[i])
For [3; 3; 5; 0; 0; 3; 1; 4]:
optimal partition i = 2:
left[2] = sell@5 after buy@3 = 2
right[2] = sell@4 after buy@0 in [2..7] = 4
total = 6
Tests parallel forward + backward passes on parallel DP arrays,
mixed ref + array state, for downto + for ascending scans on
the same data.
190 baseline programs total.
This commit is contained in:
@@ -166,6 +166,7 @@
|
||||
"shuffle.ml": 55,
|
||||
"simpson_int.ml": 10000,
|
||||
"stable_unique.ml": 46,
|
||||
"stock_two.ml": 6,
|
||||
"subseq_check.ml": 3,
|
||||
"tail_factorial.ml": 479001600,
|
||||
"tarjan_scc.ml": 4,
|
||||
|
||||
Reference in New Issue
Block a user