MCPcopy Create free account
hub / github.com/algorithmzuo/algorithm-journey / query

Method query

src/class161/Code06_Tourism1.java:251–264  ·  view source on GitHub ↗
(int[] ans, int jobl, int jobr, int l, int r, int i)

Source from the content-addressed store, hash-verified

249 // ans[3] : 线段树更左侧部分的rprofit
250 // 随着线段树查询的展开,会有更右部分的信息整合进ans,最终整合出整体信息
251 public static void query(int[] ans, int jobl, int jobr, int l, int r, int i) {
252 if (jobl <= l && r <= jobr) {
253 merge(ans, max[i], min[i], lprofit[i], rprofit[i]);
254 } else {
255 down(i);
256 int mid = (l + r) / 2;
257 if (jobl <= mid) {
258 query(ans, jobl, jobr, l, mid, i << 1);
259 }
260 if (jobr > mid) {
261 query(ans, jobl, jobr, mid + 1, r, i << 1 | 1);
262 }
263 }
264 }
265
266 public static void query(int[] ans, int jobl, int jobr) {
267 ans[0] = -INF;

Callers 1

computeMethod · 0.95

Calls 2

mergeMethod · 0.95
downMethod · 0.95

Tested by

no test coverage detected