MCPcopy Create free account
hub / github.com/ShahjalalShohag/code-library / query

Method query

Data Structures/Segment Tree NonRecursive.cpp:35–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33 }
34
35 Node query(int l, int r) {
36 --l;
37 bool f1 = 1, f2 = 1;
38 Node resl, resr;
39 for(l += n, r += n; l < r; l >>= 1, r >>= 1) {
40 if(l & 1) resl = f1 ? t[l++] : combine(resl, t[l++]), f1 = 0;
41 if(r & 1) resr = f2 ? t[--r] : combine(t[--r], resr), f2 = 0;
42 }
43 if(f2) return resl;
44 if(f1) return resr;
45 return combine(resl, resr);
46 }
47};
48
49int32_t main() {

Callers 1

mainFunction · 0.45

Calls 1

combineFunction · 0.70

Tested by

no test coverage detected