Documentation for 8b1eab204b
@@ -1,3 +1,4 @@
|
||||
<!-- HTML header for doxygen 1.12.0-->
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
|
||||
<head>
|
||||
@@ -5,10 +6,15 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.12.0"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Algorithms_in_C++: range_queries/segtree.cpp File Reference</title>
|
||||
<title>TheAlgorithms/C++: range_queries/segtree.cpp File Reference</title>
|
||||
<link rel="icon" href="../../favicon.svg" type="image/x-icon" />
|
||||
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="../../jquery.js"></script>
|
||||
<script type="text/javascript" src="../../dynsections.js"></script>
|
||||
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@xpack-3rd-party/doxygen-awesome-css@2.2.0-1/doxygen-awesome-darkmode-toggle.js"></script>
|
||||
<script type="text/javascript">
|
||||
DoxygenAwesomeDarkModeToggle.init()
|
||||
</script>
|
||||
<script type="text/javascript" src="../../clipboard.js"></script>
|
||||
<link href="../../navtree.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="../../navtreedata.js"></script>
|
||||
@@ -18,14 +24,24 @@
|
||||
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="../../search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="../../search/search.js"></script>
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
|
||||
jax: ["input/TeX","output/HTML-CSS"],
|
||||
});
|
||||
<script type="text/javascript">
|
||||
window.MathJax = {
|
||||
options: {
|
||||
ignoreHtmlClass: 'tex2jax_ignore',
|
||||
processHtmlClass: 'tex2jax_process'
|
||||
},
|
||||
loader: {
|
||||
load: ['[tex]/ams']
|
||||
},
|
||||
tex: {
|
||||
macros: {},
|
||||
packages: ['base','configmacros','ams']
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script type="text/javascript" async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML/MathJax.js"></script>
|
||||
<script type="text/javascript" id="MathJax-script" async="async" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js"></script>
|
||||
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
|
||||
<link href="../../doxygen-awesome.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
@@ -33,10 +49,11 @@ MathJax.Hub.Config({
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr id="projectrow">
|
||||
<td id="projectlogo"><img alt="Logo" src="../../project_logo.png"/></td>
|
||||
<td id="projectalign">
|
||||
<div id="projectname">Algorithms_in_C++<span id="projectnumber"> 1.0.0</span>
|
||||
<div id="projectname">TheAlgorithms/C++<span id="projectnumber"> 1.0.0</span>
|
||||
</div>
|
||||
<div id="projectbrief">Set of algorithms implemented in C++.</div>
|
||||
<div id="projectbrief">All the algorithms implemented in C++</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@@ -122,16 +139,18 @@ Include dependency graph for segtree.cpp:</div>
|
||||
<div class="dyncontent">
|
||||
<div class="center"><iframe scrolling="no" frameborder="0" src="../../de/db6/segtree_8cpp__incl.svg" width="418" height="111"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
|
||||
</div>
|
||||
</div><table class="memberdecls">
|
||||
</div>
|
||||
<p><a href="../../d2/d45/segtree_8cpp_source.html">Go to the source code of this file.</a></p>
|
||||
<table class="memberdecls">
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
|
||||
Functions</h2></td></tr>
|
||||
<tr class="memitem:ae752659b7c1719d68fdb2ca538a93696" id="r_ae752659b7c1719d68fdb2ca538a93696"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="#ae752659b7c1719d68fdb2ca538a93696">ConsTree</a> (const <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>< int64_t > &arr, <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>< int64_t > *segtree, uint64_t low, uint64_t high, uint64_t pos)</td></tr>
|
||||
<tr class="memdesc:ae752659b7c1719d68fdb2ca538a93696"><td class="mdescLeft"> </td><td class="mdescRight">for <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a> <br /></td></tr>
|
||||
<tr class="memitem:ae752659b7c1719d68fdb2ca538a93696" id="r_ae752659b7c1719d68fdb2ca538a93696"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="#ae752659b7c1719d68fdb2ca538a93696">ConsTree</a> (const std::vector< int64_t > &arr, std::vector< int64_t > *segtree, uint64_t low, uint64_t high, uint64_t pos)</td></tr>
|
||||
<tr class="memdesc:ae752659b7c1719d68fdb2ca538a93696"><td class="mdescLeft"> </td><td class="mdescRight">for std::vector <br /></td></tr>
|
||||
<tr class="separator:ae752659b7c1719d68fdb2ca538a93696"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a423a97ea0c7ea6e33b5844a6858d902d" id="r_a423a97ea0c7ea6e33b5844a6858d902d"><td class="memItemLeft" align="right" valign="top">int64_t </td><td class="memItemRight" valign="bottom"><a class="el" href="#a423a97ea0c7ea6e33b5844a6858d902d">query</a> (<a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>< int64_t > *segtree, <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>< int64_t > *lazy, uint64_t qlow, uint64_t qhigh, uint64_t low, uint64_t high, uint64_t pos)</td></tr>
|
||||
<tr class="memitem:a423a97ea0c7ea6e33b5844a6858d902d" id="r_a423a97ea0c7ea6e33b5844a6858d902d"><td class="memItemLeft" align="right" valign="top">int64_t </td><td class="memItemRight" valign="bottom"><a class="el" href="#a423a97ea0c7ea6e33b5844a6858d902d">query</a> (std::vector< int64_t > *segtree, std::vector< int64_t > *lazy, uint64_t qlow, uint64_t qhigh, uint64_t low, uint64_t high, uint64_t pos)</td></tr>
|
||||
<tr class="memdesc:a423a97ea0c7ea6e33b5844a6858d902d"><td class="mdescLeft"> </td><td class="mdescRight">Returns the sum of all elements in a range. <br /></td></tr>
|
||||
<tr class="separator:a423a97ea0c7ea6e33b5844a6858d902d"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:abd3e818681fb2e29cf08f4f60f82c8e0" id="r_abd3e818681fb2e29cf08f4f60f82c8e0"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="#abd3e818681fb2e29cf08f4f60f82c8e0">update</a> (<a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>< int64_t > *segtree, <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>< int64_t > *lazy, int64_t start, int64_t end, int64_t delta, uint64_t low, uint64_t high, uint64_t pos)</td></tr>
|
||||
<tr class="memitem:abd3e818681fb2e29cf08f4f60f82c8e0" id="r_abd3e818681fb2e29cf08f4f60f82c8e0"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="#abd3e818681fb2e29cf08f4f60f82c8e0">update</a> (std::vector< int64_t > *segtree, std::vector< int64_t > *lazy, int64_t start, int64_t end, int64_t delta, uint64_t low, uint64_t high, uint64_t pos)</td></tr>
|
||||
<tr class="memdesc:abd3e818681fb2e29cf08f4f60f82c8e0"><td class="mdescLeft"> </td><td class="mdescRight">Updates a range of the segment tree. <br /></td></tr>
|
||||
<tr class="separator:abd3e818681fb2e29cf08f4f60f82c8e0"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:aa8dca7b867074164d5f45b0f3851269d" id="r_aa8dca7b867074164d5f45b0f3851269d"><td class="memItemLeft" align="right" valign="top">static void </td><td class="memItemRight" valign="bottom"><a class="el" href="#aa8dca7b867074164d5f45b0f3851269d">test</a> ()</td></tr>
|
||||
@@ -155,6 +174,8 @@ Functions</h2></td></tr>
|
||||
<a href="https://github.com/sohamroy19" target="_blank">Soham Roy</a> </dd></dl>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p class="definition">Definition in file <a class="el" href="../../d2/d45/segtree_8cpp_source.html">segtree.cpp</a>.</p>
|
||||
</div><h2 class="groupheader">Function Documentation</h2>
|
||||
<a id="ae752659b7c1719d68fdb2ca538a93696" name="ae752659b7c1719d68fdb2ca538a93696"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#ae752659b7c1719d68fdb2ca538a93696">◆ </a></span>ConsTree()</h2>
|
||||
@@ -165,12 +186,12 @@ Functions</h2></td></tr>
|
||||
<tr>
|
||||
<td class="memname">void ConsTree </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype">const <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>< int64_t > &</td> <td class="paramname"><span class="paramname"><em>arr</em></span>, </td>
|
||||
<td class="paramtype">const std::vector< int64_t > &</td> <td class="paramname"><span class="paramname"><em>arr</em></span>, </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype"><a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>< int64_t > *</td> <td class="paramname"><span class="paramname"><em>segtree</em></span>, </td>
|
||||
<td class="paramtype">std::vector< int64_t > *</td> <td class="paramname"><span class="paramname"><em>segtree</em></span>, </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
@@ -190,8 +211,8 @@ Functions</h2></td></tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>for <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a> </p>
|
||||
<p>for assert for log2 for <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/types/integer.html">std::uint64_t</a> for IO operations</p>
|
||||
<p>for std::vector </p>
|
||||
<p>for assert for log2 for std::uint64_t for IO operations</p>
|
||||
<p>Constructs the initial segment tree</p>
|
||||
<dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
@@ -204,6 +225,8 @@ Functions</h2></td></tr>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="section return"><dt>Returns</dt><dd>void </dd></dl>
|
||||
|
||||
<p class="definition">Definition at line <a class="el" href="../../d2/d45/segtree_8cpp_source.html#l00038">38</a> of file <a class="el" href="../../d2/d45/segtree_8cpp_source.html">segtree.cpp</a>.</p>
|
||||
<div class="fragment"><div class="line"><span class="lineno"> 39</span> {</div>
|
||||
<div class="line"><span class="lineno"> 40</span> <span class="keywordflow">if</span> (low == high) {</div>
|
||||
<div class="line"><span class="lineno"> 41</span> (*segtree)[pos] = arr[low];</div>
|
||||
@@ -215,13 +238,8 @@ Functions</h2></td></tr>
|
||||
<div class="line"><span class="lineno"> 47</span> <a class="code hl_function" href="#ae752659b7c1719d68fdb2ca538a93696">ConsTree</a>(arr, segtree, mid + 1, high, 2 * pos + 2);</div>
|
||||
<div class="line"><span class="lineno"> 48</span> (*segtree)[pos] = (*segtree)[2 * pos + 1] + (*segtree)[2 * pos + 2];</div>
|
||||
<div class="line"><span class="lineno"> 49</span>}</div>
|
||||
<div class="ttc" id="asegtree_8cpp_html_ae752659b7c1719d68fdb2ca538a93696"><div class="ttname"><a href="#ae752659b7c1719d68fdb2ca538a93696">ConsTree</a></div><div class="ttdeci">void ConsTree(const std::vector< int64_t > &arr, std::vector< int64_t > *segtree, uint64_t low, uint64_t high, uint64_t pos)</div><div class="ttdoc">for std::vector</div><div class="ttdef"><b>Definition</b> segtree.cpp:38</div></div>
|
||||
</div><!-- fragment --><div class="dynheader">
|
||||
Here is the call graph for this function:</div>
|
||||
<div class="dyncontent">
|
||||
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d2/d45/segtree_8cpp_ae752659b7c1719d68fdb2ca538a93696_cgraph.svg" width="90" height="60"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
|
||||
</div>
|
||||
|
||||
<div class="ttc" id="asegtree_8cpp_html_ae752659b7c1719d68fdb2ca538a93696"><div class="ttname"><a href="#ae752659b7c1719d68fdb2ca538a93696">ConsTree</a></div><div class="ttdeci">void ConsTree(const std::vector< int64_t > &arr, std::vector< int64_t > *segtree, uint64_t low, uint64_t high, uint64_t pos)</div><div class="ttdoc">for std::vector</div><div class="ttdef"><b>Definition</b> <a href="../../d2/d45/segtree_8cpp_source.html#l00038">segtree.cpp:38</a></div></div>
|
||||
</div><!-- fragment -->
|
||||
</div>
|
||||
</div>
|
||||
<a id="ae66f6b31b5ad750f1fe042a706a4e3d4" name="ae66f6b31b5ad750f1fe042a706a4e3d4"></a>
|
||||
@@ -241,73 +259,64 @@ Here is the call graph for this function:</div>
|
||||
|
||||
<p>Main function. </p>
|
||||
<dl class="section return"><dt>Returns</dt><dd>0 on exit </dd></dl>
|
||||
|
||||
<p class="definition">Definition at line <a class="el" href="../../d2/d45/segtree_8cpp_source.html#l00168">168</a> of file <a class="el" href="../../d2/d45/segtree_8cpp_source.html">segtree.cpp</a>.</p>
|
||||
<div class="fragment"><div class="line"><span class="lineno"> 168</span> {</div>
|
||||
<div class="line"><span class="lineno"> 169</span> <a class="code hl_function" href="#aa8dca7b867074164d5f45b0f3851269d">test</a>(); <span class="comment">// run self-test implementations</span></div>
|
||||
<div class="line"><span class="lineno"> 170</span> </div>
|
||||
<div class="line"><span class="lineno"> 171</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Enter number of elements: "</span>;</div>
|
||||
<div class="line"><span class="lineno"> 171</span> std::cout << <span class="stringliteral">"Enter number of elements: "</span>;</div>
|
||||
<div class="line"><span class="lineno"> 172</span> </div>
|
||||
<div class="line"><span class="lineno"> 173</span> uint64_t n = 0;</div>
|
||||
<div class="line"><span class="lineno"> 174</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_istream.html">std::cin</a> >> n;</div>
|
||||
<div class="line"><span class="lineno"> 174</span> std::cin >> n;</div>
|
||||
<div class="line"><span class="lineno"> 175</span> </div>
|
||||
<div class="line"><span class="lineno"> 176</span> <span class="keyword">auto</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/max.html">max</a> = <span class="keyword">static_cast<</span>uint64_t<span class="keyword">></span>(2 * <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/math/pow.html">pow</a>(2, <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/math/ceil.html">ceil</a>(log2(n))) - 1);</div>
|
||||
<div class="line"><span class="lineno"> 177</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector<int64_t></a> arr(n), lazy(max), segtree(max);</div>
|
||||
<div class="line"><span class="lineno"> 176</span> <span class="keyword">auto</span> max = <span class="keyword">static_cast<</span>uint64_t<span class="keyword">></span>(2 * pow(2, ceil(log2(n))) - 1);</div>
|
||||
<div class="line"><span class="lineno"> 177</span> std::vector<int64_t> arr(n), lazy(max), segtree(max);</div>
|
||||
<div class="line"><span class="lineno"> 178</span> </div>
|
||||
<div class="line"><span class="lineno"> 179</span> <span class="keywordtype">int</span> choice = 0;</div>
|
||||
<div class="line"><span class="lineno"> 180</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"\nDo you wish to enter each number?:\n"</span></div>
|
||||
<div class="line"><span class="lineno"> 180</span> std::cout << <span class="stringliteral">"\nDo you wish to enter each number?:\n"</span></div>
|
||||
<div class="line"><span class="lineno"> 181</span> <span class="stringliteral">"1: Yes\n"</span></div>
|
||||
<div class="line"><span class="lineno"> 182</span> <span class="stringliteral">"0: No (default initialize them to 0)\n"</span>;</div>
|
||||
<div class="line"><span class="lineno"> 183</span> </div>
|
||||
<div class="line"><span class="lineno"> 184</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_istream.html">std::cin</a> >> choice;</div>
|
||||
<div class="line"><span class="lineno"> 184</span> std::cin >> choice;</div>
|
||||
<div class="line"><span class="lineno"> 185</span> <span class="keywordflow">if</span> (choice == 1) {</div>
|
||||
<div class="line"><span class="lineno"> 186</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Enter "</span> << n << <span class="stringliteral">" numbers:\n"</span>;</div>
|
||||
<div class="line"><span class="lineno"> 186</span> std::cout << <span class="stringliteral">"Enter "</span> << n << <span class="stringliteral">" numbers:\n"</span>;</div>
|
||||
<div class="line"><span class="lineno"> 187</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 1; i <= n; i++) {</div>
|
||||
<div class="line"><span class="lineno"> 188</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << i << <span class="stringliteral">": "</span>;</div>
|
||||
<div class="line"><span class="lineno"> 189</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_istream.html">std::cin</a> >> arr[i];</div>
|
||||
<div class="line"><span class="lineno"> 188</span> std::cout << i << <span class="stringliteral">": "</span>;</div>
|
||||
<div class="line"><span class="lineno"> 189</span> std::cin >> arr[i];</div>
|
||||
<div class="line"><span class="lineno"> 190</span> }</div>
|
||||
<div class="line"><span class="lineno"> 191</span> }</div>
|
||||
<div class="line"><span class="lineno"> 192</span> </div>
|
||||
<div class="line"><span class="lineno"> 193</span> <a class="code hl_function" href="#ae752659b7c1719d68fdb2ca538a93696">ConsTree</a>(arr, &segtree, 0, n - 1, 0);</div>
|
||||
<div class="line"><span class="lineno"> 194</span> </div>
|
||||
<div class="line"><span class="lineno"> 195</span> <span class="keywordflow">do</span> {</div>
|
||||
<div class="line"><span class="lineno"> 196</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"\nMake your choice:\n"</span></div>
|
||||
<div class="line"><span class="lineno"> 196</span> std::cout << <span class="stringliteral">"\nMake your choice:\n"</span></div>
|
||||
<div class="line"><span class="lineno"> 197</span> <span class="stringliteral">"1: Range update (input)\n"</span></div>
|
||||
<div class="line"><span class="lineno"> 198</span> <span class="stringliteral">"2: Range query (output)\n"</span></div>
|
||||
<div class="line"><span class="lineno"> 199</span> <span class="stringliteral">"0: Exit\n"</span>;</div>
|
||||
<div class="line"><span class="lineno"> 200</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_istream.html">std::cin</a> >> choice;</div>
|
||||
<div class="line"><span class="lineno"> 200</span> std::cin >> choice;</div>
|
||||
<div class="line"><span class="lineno"> 201</span> </div>
|
||||
<div class="line"><span class="lineno"> 202</span> <span class="keywordflow">if</span> (choice == 1) {</div>
|
||||
<div class="line"><span class="lineno"> 203</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Enter 1-indexed lower bound, upper bound & value:\n"</span>;</div>
|
||||
<div class="line"><span class="lineno"> 203</span> std::cout << <span class="stringliteral">"Enter 1-indexed lower bound, upper bound & value:\n"</span>;</div>
|
||||
<div class="line"><span class="lineno"> 204</span> </div>
|
||||
<div class="line"><span class="lineno"> 205</span> uint64_t p = 1, q = 1, v = 0;</div>
|
||||
<div class="line"><span class="lineno"> 206</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_istream.html">std::cin</a> >> p >> q >> v;</div>
|
||||
<div class="line"><span class="lineno"> 206</span> std::cin >> p >> q >> v;</div>
|
||||
<div class="line"><span class="lineno"> 207</span> <a class="code hl_function" href="#abd3e818681fb2e29cf08f4f60f82c8e0">update</a>(&segtree, &lazy, p - 1, q - 1, v, 0, n - 1, 0);</div>
|
||||
<div class="line"><span class="lineno"> 208</span> } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (choice == 2) {</div>
|
||||
<div class="line"><span class="lineno"> 209</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Enter 1-indexed lower bound & upper bound:\n"</span>;</div>
|
||||
<div class="line"><span class="lineno"> 209</span> std::cout << <span class="stringliteral">"Enter 1-indexed lower bound & upper bound:\n"</span>;</div>
|
||||
<div class="line"><span class="lineno"> 210</span> </div>
|
||||
<div class="line"><span class="lineno"> 211</span> uint64_t p = 1, q = 1;</div>
|
||||
<div class="line"><span class="lineno"> 212</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_istream.html">std::cin</a> >> p >> q;</div>
|
||||
<div class="line"><span class="lineno"> 213</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <a class="code hl_function" href="#a423a97ea0c7ea6e33b5844a6858d902d">query</a>(&segtree, &lazy, p - 1, q - 1, 0, n - 1, 0);</div>
|
||||
<div class="line"><span class="lineno"> 214</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"\n"</span>;</div>
|
||||
<div class="line"><span class="lineno"> 212</span> std::cin >> p >> q;</div>
|
||||
<div class="line"><span class="lineno"> 213</span> std::cout << <a class="code hl_function" href="#a423a97ea0c7ea6e33b5844a6858d902d">query</a>(&segtree, &lazy, p - 1, q - 1, 0, n - 1, 0);</div>
|
||||
<div class="line"><span class="lineno"> 214</span> std::cout << <span class="stringliteral">"\n"</span>;</div>
|
||||
<div class="line"><span class="lineno"> 215</span> }</div>
|
||||
<div class="line"><span class="lineno"> 216</span> } <span class="keywordflow">while</span> (choice > 0);</div>
|
||||
<div class="line"><span class="lineno"> 217</span> </div>
|
||||
<div class="line"><span class="lineno"> 218</span> <span class="keywordflow">return</span> 0;</div>
|
||||
<div class="line"><span class="lineno"> 219</span>}</div>
|
||||
<div class="ttc" id="abasic_istream_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/basic_istream.html">std::cin</a></div></div>
|
||||
<div class="ttc" id="abasic_ostream_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a></div></div>
|
||||
<div class="ttc" id="aceil_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/numeric/math/ceil.html">std::ceil</a></div><div class="ttdeci">T ceil(T... args)</div></div>
|
||||
<div class="ttc" id="amax_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/algorithm/max.html">std::max</a></div><div class="ttdeci">T max(T... args)</div></div>
|
||||
<div class="ttc" id="apow_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/numeric/math/pow.html">std::pow</a></div><div class="ttdeci">T pow(T... args)</div></div>
|
||||
<div class="ttc" id="asegtree_8cpp_html_a423a97ea0c7ea6e33b5844a6858d902d"><div class="ttname"><a href="#a423a97ea0c7ea6e33b5844a6858d902d">query</a></div><div class="ttdeci">int64_t query(std::vector< int64_t > *segtree, std::vector< int64_t > *lazy, uint64_t qlow, uint64_t qhigh, uint64_t low, uint64_t high, uint64_t pos)</div><div class="ttdoc">Returns the sum of all elements in a range.</div><div class="ttdef"><b>Definition</b> segtree.cpp:63</div></div>
|
||||
<div class="ttc" id="asegtree_8cpp_html_aa8dca7b867074164d5f45b0f3851269d"><div class="ttname"><a href="#aa8dca7b867074164d5f45b0f3851269d">test</a></div><div class="ttdeci">static void test()</div><div class="ttdoc">Self-test implementation.</div><div class="ttdef"><b>Definition</b> segtree.cpp:147</div></div>
|
||||
<div class="ttc" id="asegtree_8cpp_html_abd3e818681fb2e29cf08f4f60f82c8e0"><div class="ttname"><a href="#abd3e818681fb2e29cf08f4f60f82c8e0">update</a></div><div class="ttdeci">void update(std::vector< int64_t > *segtree, std::vector< int64_t > *lazy, int64_t start, int64_t end, int64_t delta, uint64_t low, uint64_t high, uint64_t pos)</div><div class="ttdoc">Updates a range of the segment tree.</div><div class="ttdef"><b>Definition</b> segtree.cpp:103</div></div>
|
||||
<div class="ttc" id="avector_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a></div></div>
|
||||
</div><!-- fragment --><div class="dynheader">
|
||||
Here is the call graph for this function:</div>
|
||||
<div class="dyncontent">
|
||||
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d2/d45/segtree_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg" width="278" height="208"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
|
||||
</div>
|
||||
|
||||
<div class="ttc" id="asegtree_8cpp_html_a423a97ea0c7ea6e33b5844a6858d902d"><div class="ttname"><a href="#a423a97ea0c7ea6e33b5844a6858d902d">query</a></div><div class="ttdeci">int64_t query(std::vector< int64_t > *segtree, std::vector< int64_t > *lazy, uint64_t qlow, uint64_t qhigh, uint64_t low, uint64_t high, uint64_t pos)</div><div class="ttdoc">Returns the sum of all elements in a range.</div><div class="ttdef"><b>Definition</b> <a href="../../d2/d45/segtree_8cpp_source.html#l00063">segtree.cpp:63</a></div></div>
|
||||
<div class="ttc" id="asegtree_8cpp_html_aa8dca7b867074164d5f45b0f3851269d"><div class="ttname"><a href="#aa8dca7b867074164d5f45b0f3851269d">test</a></div><div class="ttdeci">static void test()</div><div class="ttdoc">Self-test implementation.</div><div class="ttdef"><b>Definition</b> <a href="../../d2/d45/segtree_8cpp_source.html#l00147">segtree.cpp:147</a></div></div>
|
||||
<div class="ttc" id="asegtree_8cpp_html_abd3e818681fb2e29cf08f4f60f82c8e0"><div class="ttname"><a href="#abd3e818681fb2e29cf08f4f60f82c8e0">update</a></div><div class="ttdeci">void update(std::vector< int64_t > *segtree, std::vector< int64_t > *lazy, int64_t start, int64_t end, int64_t delta, uint64_t low, uint64_t high, uint64_t pos)</div><div class="ttdoc">Updates a range of the segment tree.</div><div class="ttdef"><b>Definition</b> <a href="../../d2/d45/segtree_8cpp_source.html#l00103">segtree.cpp:103</a></div></div>
|
||||
</div><!-- fragment -->
|
||||
</div>
|
||||
</div>
|
||||
<a id="a423a97ea0c7ea6e33b5844a6858d902d" name="a423a97ea0c7ea6e33b5844a6858d902d"></a>
|
||||
@@ -319,12 +328,12 @@ Here is the call graph for this function:</div>
|
||||
<tr>
|
||||
<td class="memname">int64_t query </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype"><a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>< int64_t > *</td> <td class="paramname"><span class="paramname"><em>segtree</em></span>, </td>
|
||||
<td class="paramtype">std::vector< int64_t > *</td> <td class="paramname"><span class="paramname"><em>segtree</em></span>, </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype"><a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>< int64_t > *</td> <td class="paramname"><span class="paramname"><em>lazy</em></span>, </td>
|
||||
<td class="paramtype">std::vector< int64_t > *</td> <td class="paramname"><span class="paramname"><em>lazy</em></span>, </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
@@ -368,6 +377,8 @@ Here is the call graph for this function:</div>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="section return"><dt>Returns</dt><dd>result of the range query for this function call </dd></dl>
|
||||
|
||||
<p class="definition">Definition at line <a class="el" href="../../d2/d45/segtree_8cpp_source.html#l00063">63</a> of file <a class="el" href="../../d2/d45/segtree_8cpp_source.html">segtree.cpp</a>.</p>
|
||||
<div class="fragment"><div class="line"><span class="lineno"> 65</span> {</div>
|
||||
<div class="line"><span class="lineno"> 66</span> <span class="keywordflow">if</span> (low > high || qlow > high || low > qhigh) {</div>
|
||||
<div class="line"><span class="lineno"> 67</span> <span class="keywordflow">return</span> 0;</div>
|
||||
@@ -392,12 +403,7 @@ Here is the call graph for this function:</div>
|
||||
<div class="line"><span class="lineno"> 86</span> <span class="keywordflow">return</span> <a class="code hl_function" href="#a423a97ea0c7ea6e33b5844a6858d902d">query</a>(segtree, lazy, qlow, qhigh, low, mid, 2 * pos + 1) +</div>
|
||||
<div class="line"><span class="lineno"> 87</span> <a class="code hl_function" href="#a423a97ea0c7ea6e33b5844a6858d902d">query</a>(segtree, lazy, qlow, qhigh, mid + 1, high, 2 * pos + 2);</div>
|
||||
<div class="line"><span class="lineno"> 88</span>}</div>
|
||||
</div><!-- fragment --><div class="dynheader">
|
||||
Here is the call graph for this function:</div>
|
||||
<div class="dyncontent">
|
||||
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d2/d45/segtree_8cpp_a423a97ea0c7ea6e33b5844a6858d902d_cgraph.svg" width="64" height="60"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
|
||||
</div>
|
||||
|
||||
</div><!-- fragment -->
|
||||
</div>
|
||||
</div>
|
||||
<a id="aa8dca7b867074164d5f45b0f3851269d" name="aa8dca7b867074164d5f45b0f3851269d"></a>
|
||||
@@ -425,11 +431,13 @@ Here is the call graph for this function:</div>
|
||||
|
||||
<p>Self-test implementation. </p>
|
||||
<dl class="section return"><dt>Returns</dt><dd>void </dd></dl>
|
||||
|
||||
<p class="definition">Definition at line <a class="el" href="../../d2/d45/segtree_8cpp_source.html#l00147">147</a> of file <a class="el" href="../../d2/d45/segtree_8cpp_source.html">segtree.cpp</a>.</p>
|
||||
<div class="fragment"><div class="line"><span class="lineno"> 147</span> {</div>
|
||||
<div class="line"><span class="lineno"> 148</span> <span class="keyword">auto</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/max.html">max</a> = <span class="keyword">static_cast<</span>int64_t<span class="keyword">></span>(2 * <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/math/pow.html">pow</a>(2, <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/math/ceil.html">ceil</a>(log2(7))) - 1);</div>
|
||||
<div class="line"><span class="lineno"> 148</span> <span class="keyword">auto</span> max = <span class="keyword">static_cast<</span>int64_t<span class="keyword">></span>(2 * pow(2, ceil(log2(7))) - 1);</div>
|
||||
<div class="line"><span class="lineno"> 149</span> assert(max == 15);</div>
|
||||
<div class="line"><span class="lineno"> 150</span> </div>
|
||||
<div class="line"><span class="lineno"> 151</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector<int64_t></a> arr{1, 2, 3, 4, 5, 6, 7}, lazy(max), segtree(max);</div>
|
||||
<div class="line"><span class="lineno"> 151</span> std::vector<int64_t> arr{1, 2, 3, 4, 5, 6, 7}, lazy(max), segtree(max);</div>
|
||||
<div class="line"><span class="lineno"> 152</span> <a class="code hl_function" href="#ae752659b7c1719d68fdb2ca538a93696">ConsTree</a>(arr, &segtree, 0, 7 - 1, 0);</div>
|
||||
<div class="line"><span class="lineno"> 153</span> </div>
|
||||
<div class="line"><span class="lineno"> 154</span> assert(<a class="code hl_function" href="#a423a97ea0c7ea6e33b5844a6858d902d">query</a>(&segtree, &lazy, 1, 5, 0, 7 - 1, 0) == 2 + 3 + 4 + 5 + 6);</div>
|
||||
@@ -440,12 +448,7 @@ Here is the call graph for this function:</div>
|
||||
<div class="line"><span class="lineno"> 159</span> <a class="code hl_function" href="#abd3e818681fb2e29cf08f4f60f82c8e0">update</a>(&segtree, &lazy, 0, 6, -2, 0, 7 - 1, 0);</div>
|
||||
<div class="line"><span class="lineno"> 160</span> assert(<a class="code hl_function" href="#a423a97ea0c7ea6e33b5844a6858d902d">query</a>(&segtree, &lazy, 0, 4, 0, 7 - 1, 0) == -1 + 0 + 2 + 3 + 4);</div>
|
||||
<div class="line"><span class="lineno"> 161</span>}</div>
|
||||
</div><!-- fragment --><div class="dynheader">
|
||||
Here is the call graph for this function:</div>
|
||||
<div class="dyncontent">
|
||||
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d2/d45/segtree_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.svg" width="180" height="207"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
|
||||
</div>
|
||||
|
||||
</div><!-- fragment -->
|
||||
</div>
|
||||
</div>
|
||||
<a id="abd3e818681fb2e29cf08f4f60f82c8e0" name="abd3e818681fb2e29cf08f4f60f82c8e0"></a>
|
||||
@@ -457,12 +460,12 @@ Here is the call graph for this function:</div>
|
||||
<tr>
|
||||
<td class="memname">void update </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype"><a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>< int64_t > *</td> <td class="paramname"><span class="paramname"><em>segtree</em></span>, </td>
|
||||
<td class="paramtype">std::vector< int64_t > *</td> <td class="paramname"><span class="paramname"><em>segtree</em></span>, </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype"><a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>< int64_t > *</td> <td class="paramname"><span class="paramname"><em>lazy</em></span>, </td>
|
||||
<td class="paramtype">std::vector< int64_t > *</td> <td class="paramname"><span class="paramname"><em>lazy</em></span>, </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
@@ -512,6 +515,8 @@ Here is the call graph for this function:</div>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="section return"><dt>Returns</dt><dd>void </dd></dl>
|
||||
|
||||
<p class="definition">Definition at line <a class="el" href="../../d2/d45/segtree_8cpp_source.html#l00103">103</a> of file <a class="el" href="../../d2/d45/segtree_8cpp_source.html">segtree.cpp</a>.</p>
|
||||
<div class="fragment"><div class="line"><span class="lineno"> 105</span> {</div>
|
||||
<div class="line"><span class="lineno"> 106</span> <span class="keywordflow">if</span> (low > high) {</div>
|
||||
<div class="line"><span class="lineno"> 107</span> <span class="keywordflow">return</span>;</div>
|
||||
@@ -548,12 +553,7 @@ Here is the call graph for this function:</div>
|
||||
<div class="line"><span class="lineno"> 138</span> <a class="code hl_function" href="#abd3e818681fb2e29cf08f4f60f82c8e0">update</a>(segtree, lazy, start, end, delta, mid + 1, high, 2 * pos + 2);</div>
|
||||
<div class="line"><span class="lineno"> 139</span> (*segtree)[pos] = (*segtree)[2 * pos + 1] + (*segtree)[2 * pos + 2];</div>
|
||||
<div class="line"><span class="lineno"> 140</span>}</div>
|
||||
</div><!-- fragment --><div class="dynheader">
|
||||
Here is the call graph for this function:</div>
|
||||
<div class="dyncontent">
|
||||
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d2/d45/segtree_8cpp_abd3e818681fb2e29cf08f4f60f82c8e0_cgraph.svg" width="71" height="60"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
|
||||
</div>
|
||||
|
||||
</div><!-- fragment -->
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- contents -->
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
<map id="query" name="query">
|
||||
<area shape="rect" id="Node000001" title="Returns the sum of all elements in a range." alt="" coords="5,29,59,55"/>
|
||||
<area shape="poly" id="edge1_Node000001_Node000001" title=" " alt="" coords="21,29,20,12,25,5,32,3,40,6,44,12,39,15,36,10,32,8,28,9,25,13,26,29"/>
|
||||
</map>
|
||||
@@ -1 +0,0 @@
|
||||
4beb5565895e9cc3a907595a928822dd
|
||||
@@ -1,56 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
|
||||
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<!-- Generated by graphviz version 12.1.2 (20240928.0832)
|
||||
-->
|
||||
<!-- Title: query Pages: 1 -->
|
||||
<svg width="48pt" height="45pt"
|
||||
viewBox="0.00 0.00 48.00 45.25" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
|
||||
<svg id="main" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve">
|
||||
|
||||
<style type="text/css"><![CDATA[
|
||||
.node, .edge {opacity: 0.7;}
|
||||
.node.selected, .edge.selected {opacity: 1;}
|
||||
.edge:hover path { stroke: red; }
|
||||
.edge:hover polygon { stroke: red; fill: red; }
|
||||
]]></style>
|
||||
<script type="application/ecmascript" xlink:href="../../svg.min.js"/>
|
||||
<svg id="graph" class="graph">
|
||||
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 41.25)">
|
||||
<title>query</title>
|
||||
<!-- Node1 -->
|
||||
<g id="Node000001" class="node">
|
||||
<title>Node1</title>
|
||||
<g id="a_Node000001"><a xlink:title="Returns the sum of all elements in a range.">
|
||||
<polygon fill="#999999" stroke="#666666" points="40,-19.25 0,-19.25 0,0 40,0 40,-19.25"/>
|
||||
<text text-anchor="middle" x="20" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">query</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node1->Node1 -->
|
||||
<g id="edge1_Node000001_Node000001" class="edge">
|
||||
<title>Node1->Node1</title>
|
||||
<g id="a_edge1_Node000001_Node000001"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M13.74,-19.54C10.88,-28.15 12.97,-37.25 20,-37.25 23.74,-37.25 26.08,-34.68 27.02,-30.98"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="30.52,-30.8 26.36,-21.05 23.53,-31.26 30.52,-30.8"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
</svg>
|
||||
|
||||
<style type='text/css'>
|
||||
<![CDATA[
|
||||
[data-mouse-over-selected='false'] { opacity: 0.7; }
|
||||
[data-mouse-over-selected='true'] { opacity: 1.0; }
|
||||
]]>
|
||||
</style>
|
||||
<script type="application/ecmascript"><![CDATA[
|
||||
document.addEventListener('DOMContentLoaded', (event) => {
|
||||
highlightEdges();
|
||||
highlightAdjacentNodes();
|
||||
});
|
||||
]]></script>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 2.0 KiB |
@@ -1,30 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
|
||||
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<!-- Generated by graphviz version 12.1.2 (20240928.0832)
|
||||
-->
|
||||
<!-- Title: query Pages: 1 -->
|
||||
<svg width="48pt" height="45pt"
|
||||
viewBox="0.00 0.00 48.00 45.25" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 41.25)">
|
||||
<title>query</title>
|
||||
<!-- Node1 -->
|
||||
<g id="Node000001" class="node">
|
||||
<title>Node1</title>
|
||||
<g id="a_Node000001"><a xlink:title="Returns the sum of all elements in a range.">
|
||||
<polygon fill="#999999" stroke="#666666" points="40,-19.25 0,-19.25 0,0 40,0 40,-19.25"/>
|
||||
<text text-anchor="middle" x="20" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">query</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node1->Node1 -->
|
||||
<g id="edge1_Node000001_Node000001" class="edge">
|
||||
<title>Node1->Node1</title>
|
||||
<g id="a_edge1_Node000001_Node000001"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M13.74,-19.54C10.88,-28.15 12.97,-37.25 20,-37.25 23.74,-37.25 26.08,-34.68 27.02,-30.98"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="30.52,-30.8 26.36,-21.05 23.53,-31.26 30.52,-30.8"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.3 KiB |
@@ -1,12 +0,0 @@
|
||||
<map id="test" name="test">
|
||||
<area shape="rect" id="Node000001" title="Self-test implementation." alt="" coords="5,103,49,128"/>
|
||||
<area shape="rect" id="Node000002" href="$d2/d45/segtree_8cpp.html#ae752659b7c1719d68fdb2ca538a93696" title="for std::vector" alt="" coords="97,29,175,55"/>
|
||||
<area shape="poly" id="edge1_Node000001_Node000002" title=" " alt="" coords="45,100,95,64,99,62,102,66,98,68,48,104"/>
|
||||
<area shape="rect" id="Node000003" href="$d2/d45/segtree_8cpp.html#a423a97ea0c7ea6e33b5844a6858d902d" title="Returns the sum of all elements in a range." alt="" coords="109,103,162,128"/>
|
||||
<area shape="poly" id="edge3_Node000001_Node000003" title=" " alt="" coords="49,113,94,113,94,118,49,118"/>
|
||||
<area shape="rect" id="Node000004" href="$d2/d45/segtree_8cpp.html#abd3e818681fb2e29cf08f4f60f82c8e0" title="Updates a range of the segment tree." alt="" coords="106,176,166,202"/>
|
||||
<area shape="poly" id="edge5_Node000001_Node000004" title=" " alt="" coords="49,127,104,165,101,169,46,131"/>
|
||||
<area shape="poly" id="edge2_Node000002_Node000002" title=" " alt="" coords="116,30,113,21,115,11,123,5,136,3,150,5,157,12,153,16,147,10,136,8,125,10,119,14,118,20,121,28"/>
|
||||
<area shape="poly" id="edge4_Node000003_Node000003" title=" " alt="" coords="116,103,113,94,115,85,123,78,136,76,150,79,157,86,153,89,147,83,136,81,125,83,119,88,118,94,121,101"/>
|
||||
<area shape="poly" id="edge6_Node000004_Node000004" title=" " alt="" coords="116,177,113,167,115,158,123,152,136,149,150,152,157,159,153,163,147,157,136,155,125,157,119,161,118,167,121,175"/>
|
||||
</map>
|
||||
@@ -1 +0,0 @@
|
||||
6c368350e0a7027c1dc6b6fa18659a3e
|
||||
@@ -1,128 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
|
||||
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<!-- Generated by graphviz version 12.1.2 (20240928.0832)
|
||||
-->
|
||||
<!-- Title: test Pages: 1 -->
|
||||
<svg width="135pt" height="155pt"
|
||||
viewBox="0.00 0.00 135.25 155.25" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
|
||||
<svg id="main" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve">
|
||||
|
||||
<style type="text/css"><![CDATA[
|
||||
.node, .edge {opacity: 0.7;}
|
||||
.node.selected, .edge.selected {opacity: 1;}
|
||||
.edge:hover path { stroke: red; }
|
||||
.edge:hover polygon { stroke: red; fill: red; }
|
||||
]]></style>
|
||||
<script type="application/ecmascript" xlink:href="../../svg.min.js"/>
|
||||
<svg id="graph" class="graph">
|
||||
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 151.25)">
|
||||
<title>test</title>
|
||||
<!-- Node1 -->
|
||||
<g id="Node000001" class="node">
|
||||
<title>Node1</title>
|
||||
<g id="a_Node000001"><a xlink:title="Self-test implementation.">
|
||||
<polygon fill="#999999" stroke="#666666" points="32.5,-74.25 0,-74.25 0,-55 32.5,-55 32.5,-74.25"/>
|
||||
<text text-anchor="middle" x="16.25" y="-60.75" font-family="Helvetica,sans-Serif" font-size="10.00">test</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node2 -->
|
||||
<g id="Node000002" class="node">
|
||||
<title>Node2</title>
|
||||
<g id="a_Node000002"><a xlink:href="../../d2/d45/segtree_8cpp.html#ae752659b7c1719d68fdb2ca538a93696" target="_top" xlink:title="for std::vector">
|
||||
<polygon fill="white" stroke="#666666" points="127.25,-129.25 68.5,-129.25 68.5,-110 127.25,-110 127.25,-129.25"/>
|
||||
<text text-anchor="middle" x="97.88" y="-115.75" font-family="Helvetica,sans-Serif" font-size="10.00">ConsTree</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node1->Node2 -->
|
||||
<g id="edge1_Node000001_Node000002" class="edge">
|
||||
<title>Node1->Node2</title>
|
||||
<g id="a_edge1_Node000001_Node000002"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M30.58,-74.59C40.84,-82.16 55.42,-92.76 68.5,-101.62 69.35,-102.2 70.21,-102.78 71.08,-103.36"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="69,-106.18 79.29,-108.69 72.81,-100.31 69,-106.18"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node3 -->
|
||||
<g id="Node000003" class="node">
|
||||
<title>Node3</title>
|
||||
<g id="a_Node000003"><a xlink:href="../../d2/d45/segtree_8cpp.html#a423a97ea0c7ea6e33b5844a6858d902d" target="_top" xlink:title="Returns the sum of all elements in a range.">
|
||||
<polygon fill="white" stroke="#666666" points="117.88,-74.25 77.88,-74.25 77.88,-55 117.88,-55 117.88,-74.25"/>
|
||||
<text text-anchor="middle" x="97.88" y="-60.75" font-family="Helvetica,sans-Serif" font-size="10.00">query</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node1->Node3 -->
|
||||
<g id="edge3_Node000001_Node000003" class="edge">
|
||||
<title>Node1->Node3</title>
|
||||
<g id="a_edge3_Node000001_Node000003"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M32.98,-64.62C42.47,-64.62 54.87,-64.62 66.23,-64.62"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="66,-68.13 76,-64.63 66,-61.13 66,-68.13"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node4 -->
|
||||
<g id="Node000004" class="node">
|
||||
<title>Node4</title>
|
||||
<g id="a_Node000004"><a xlink:href="../../d2/d45/segtree_8cpp.html#abd3e818681fb2e29cf08f4f60f82c8e0" target="_top" xlink:title="Updates a range of the segment tree.">
|
||||
<polygon fill="white" stroke="#666666" points="120.5,-19.25 75.25,-19.25 75.25,0 120.5,0 120.5,-19.25"/>
|
||||
<text text-anchor="middle" x="97.88" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">update</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node1->Node4 -->
|
||||
<g id="edge5_Node000001_Node000004" class="edge">
|
||||
<title>Node1->Node4</title>
|
||||
<g id="a_edge5_Node000001_Node000004"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M31.85,-54.54C43.42,-46.55 59.79,-35.24 73.22,-25.96"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="74.88,-29.07 81.12,-20.51 70.9,-23.31 74.88,-29.07"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node2->Node2 -->
|
||||
<g id="edge2_Node000002_Node000002" class="edge">
|
||||
<title>Node2->Node2</title>
|
||||
<g id="a_edge2_Node000002_Node000002"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M85.1,-129.54C79.27,-138.15 83.53,-147.25 97.88,-147.25 105.72,-147.25 110.55,-144.53 112.36,-140.65"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="115.86,-140.39 110.88,-131.03 108.95,-141.45 115.86,-140.39"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node3->Node3 -->
|
||||
<g id="edge4_Node000003_Node000003" class="edge">
|
||||
<title>Node3->Node3</title>
|
||||
<g id="a_edge4_Node000003_Node000003"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M85.1,-74.54C79.27,-83.15 83.53,-92.25 97.88,-92.25 105.72,-92.25 110.55,-89.53 112.36,-85.65"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="115.86,-85.39 110.88,-76.03 108.95,-86.45 115.86,-85.39"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node4->Node4 -->
|
||||
<g id="edge6_Node000004_Node000004" class="edge">
|
||||
<title>Node4->Node4</title>
|
||||
<g id="a_edge6_Node000004_Node000004"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M85.1,-19.54C79.27,-28.15 83.53,-37.25 97.88,-37.25 105.72,-37.25 110.55,-34.53 112.36,-30.65"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="115.86,-30.39 110.88,-21.03 108.95,-31.45 115.86,-30.39"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
</svg>
|
||||
|
||||
<style type='text/css'>
|
||||
<![CDATA[
|
||||
[data-mouse-over-selected='false'] { opacity: 0.7; }
|
||||
[data-mouse-over-selected='true'] { opacity: 1.0; }
|
||||
]]>
|
||||
</style>
|
||||
<script type="application/ecmascript"><![CDATA[
|
||||
document.addEventListener('DOMContentLoaded', (event) => {
|
||||
highlightEdges();
|
||||
highlightAdjacentNodes();
|
||||
});
|
||||
]]></script>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 5.4 KiB |
@@ -1,102 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
|
||||
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<!-- Generated by graphviz version 12.1.2 (20240928.0832)
|
||||
-->
|
||||
<!-- Title: test Pages: 1 -->
|
||||
<svg width="135pt" height="155pt"
|
||||
viewBox="0.00 0.00 135.25 155.25" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 151.25)">
|
||||
<title>test</title>
|
||||
<!-- Node1 -->
|
||||
<g id="Node000001" class="node">
|
||||
<title>Node1</title>
|
||||
<g id="a_Node000001"><a xlink:title="Self-test implementation.">
|
||||
<polygon fill="#999999" stroke="#666666" points="32.5,-74.25 0,-74.25 0,-55 32.5,-55 32.5,-74.25"/>
|
||||
<text text-anchor="middle" x="16.25" y="-60.75" font-family="Helvetica,sans-Serif" font-size="10.00">test</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node2 -->
|
||||
<g id="Node000002" class="node">
|
||||
<title>Node2</title>
|
||||
<g id="a_Node000002"><a xlink:href="../../d2/d45/segtree_8cpp.html#ae752659b7c1719d68fdb2ca538a93696" target="_top" xlink:title="for std::vector">
|
||||
<polygon fill="white" stroke="#666666" points="127.25,-129.25 68.5,-129.25 68.5,-110 127.25,-110 127.25,-129.25"/>
|
||||
<text text-anchor="middle" x="97.88" y="-115.75" font-family="Helvetica,sans-Serif" font-size="10.00">ConsTree</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node1->Node2 -->
|
||||
<g id="edge1_Node000001_Node000002" class="edge">
|
||||
<title>Node1->Node2</title>
|
||||
<g id="a_edge1_Node000001_Node000002"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M30.58,-74.59C40.84,-82.16 55.42,-92.76 68.5,-101.62 69.35,-102.2 70.21,-102.78 71.08,-103.36"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="69,-106.18 79.29,-108.69 72.81,-100.31 69,-106.18"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node3 -->
|
||||
<g id="Node000003" class="node">
|
||||
<title>Node3</title>
|
||||
<g id="a_Node000003"><a xlink:href="../../d2/d45/segtree_8cpp.html#a423a97ea0c7ea6e33b5844a6858d902d" target="_top" xlink:title="Returns the sum of all elements in a range.">
|
||||
<polygon fill="white" stroke="#666666" points="117.88,-74.25 77.88,-74.25 77.88,-55 117.88,-55 117.88,-74.25"/>
|
||||
<text text-anchor="middle" x="97.88" y="-60.75" font-family="Helvetica,sans-Serif" font-size="10.00">query</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node1->Node3 -->
|
||||
<g id="edge3_Node000001_Node000003" class="edge">
|
||||
<title>Node1->Node3</title>
|
||||
<g id="a_edge3_Node000001_Node000003"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M32.98,-64.62C42.47,-64.62 54.87,-64.62 66.23,-64.62"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="66,-68.13 76,-64.63 66,-61.13 66,-68.13"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node4 -->
|
||||
<g id="Node000004" class="node">
|
||||
<title>Node4</title>
|
||||
<g id="a_Node000004"><a xlink:href="../../d2/d45/segtree_8cpp.html#abd3e818681fb2e29cf08f4f60f82c8e0" target="_top" xlink:title="Updates a range of the segment tree.">
|
||||
<polygon fill="white" stroke="#666666" points="120.5,-19.25 75.25,-19.25 75.25,0 120.5,0 120.5,-19.25"/>
|
||||
<text text-anchor="middle" x="97.88" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">update</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node1->Node4 -->
|
||||
<g id="edge5_Node000001_Node000004" class="edge">
|
||||
<title>Node1->Node4</title>
|
||||
<g id="a_edge5_Node000001_Node000004"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M31.85,-54.54C43.42,-46.55 59.79,-35.24 73.22,-25.96"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="74.88,-29.07 81.12,-20.51 70.9,-23.31 74.88,-29.07"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node2->Node2 -->
|
||||
<g id="edge2_Node000002_Node000002" class="edge">
|
||||
<title>Node2->Node2</title>
|
||||
<g id="a_edge2_Node000002_Node000002"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M85.1,-129.54C79.27,-138.15 83.53,-147.25 97.88,-147.25 105.72,-147.25 110.55,-144.53 112.36,-140.65"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="115.86,-140.39 110.88,-131.03 108.95,-141.45 115.86,-140.39"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node3->Node3 -->
|
||||
<g id="edge4_Node000003_Node000003" class="edge">
|
||||
<title>Node3->Node3</title>
|
||||
<g id="a_edge4_Node000003_Node000003"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M85.1,-74.54C79.27,-83.15 83.53,-92.25 97.88,-92.25 105.72,-92.25 110.55,-89.53 112.36,-85.65"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="115.86,-85.39 110.88,-76.03 108.95,-86.45 115.86,-85.39"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node4->Node4 -->
|
||||
<g id="edge6_Node000004_Node000004" class="edge">
|
||||
<title>Node4->Node4</title>
|
||||
<g id="a_edge6_Node000004_Node000004"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M85.1,-19.54C79.27,-28.15 83.53,-37.25 97.88,-37.25 105.72,-37.25 110.55,-34.53 112.36,-30.65"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="115.86,-30.39 110.88,-21.03 108.95,-31.45 115.86,-30.39"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 4.7 KiB |
@@ -1,4 +0,0 @@
|
||||
<map id="update" name="update">
|
||||
<area shape="rect" id="Node000001" title="Updates a range of the segment tree." alt="" coords="5,29,66,55"/>
|
||||
<area shape="poly" id="edge1_Node000001_Node000001" title=" " alt="" coords="23,29,23,12,27,5,36,3,44,6,48,12,44,15,41,10,35,8,31,10,28,14,29,29"/>
|
||||
</map>
|
||||
@@ -1 +0,0 @@
|
||||
a6327aecff5a1ed72a0210ea6b30c077
|
||||
@@ -1,56 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
|
||||
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<!-- Generated by graphviz version 12.1.2 (20240928.0832)
|
||||
-->
|
||||
<!-- Title: update Pages: 1 -->
|
||||
<svg width="53pt" height="45pt"
|
||||
viewBox="0.00 0.00 53.25 45.25" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
|
||||
<svg id="main" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve">
|
||||
|
||||
<style type="text/css"><![CDATA[
|
||||
.node, .edge {opacity: 0.7;}
|
||||
.node.selected, .edge.selected {opacity: 1;}
|
||||
.edge:hover path { stroke: red; }
|
||||
.edge:hover polygon { stroke: red; fill: red; }
|
||||
]]></style>
|
||||
<script type="application/ecmascript" xlink:href="../../svg.min.js"/>
|
||||
<svg id="graph" class="graph">
|
||||
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 41.25)">
|
||||
<title>update</title>
|
||||
<!-- Node1 -->
|
||||
<g id="Node000001" class="node">
|
||||
<title>Node1</title>
|
||||
<g id="a_Node000001"><a xlink:title="Updates a range of the segment tree.">
|
||||
<polygon fill="#999999" stroke="#666666" points="45.25,-19.25 0,-19.25 0,0 45.25,0 45.25,-19.25"/>
|
||||
<text text-anchor="middle" x="22.62" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">update</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node1->Node1 -->
|
||||
<g id="edge1_Node000001_Node000001" class="edge">
|
||||
<title>Node1->Node1</title>
|
||||
<g id="a_edge1_Node000001_Node000001"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M15.54,-19.54C12.31,-28.15 14.67,-37.25 22.62,-37.25 26.85,-37.25 29.5,-34.68 30.57,-30.98"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="34.06,-30.76 29.82,-21.05 27.08,-31.28 34.06,-30.76"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
</svg>
|
||||
|
||||
<style type='text/css'>
|
||||
<![CDATA[
|
||||
[data-mouse-over-selected='false'] { opacity: 0.7; }
|
||||
[data-mouse-over-selected='true'] { opacity: 1.0; }
|
||||
]]>
|
||||
</style>
|
||||
<script type="application/ecmascript"><![CDATA[
|
||||
document.addEventListener('DOMContentLoaded', (event) => {
|
||||
highlightEdges();
|
||||
highlightAdjacentNodes();
|
||||
});
|
||||
]]></script>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 2.0 KiB |
@@ -1,30 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
|
||||
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<!-- Generated by graphviz version 12.1.2 (20240928.0832)
|
||||
-->
|
||||
<!-- Title: update Pages: 1 -->
|
||||
<svg width="53pt" height="45pt"
|
||||
viewBox="0.00 0.00 53.25 45.25" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 41.25)">
|
||||
<title>update</title>
|
||||
<!-- Node1 -->
|
||||
<g id="Node000001" class="node">
|
||||
<title>Node1</title>
|
||||
<g id="a_Node000001"><a xlink:title="Updates a range of the segment tree.">
|
||||
<polygon fill="#999999" stroke="#666666" points="45.25,-19.25 0,-19.25 0,0 45.25,0 45.25,-19.25"/>
|
||||
<text text-anchor="middle" x="22.62" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">update</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node1->Node1 -->
|
||||
<g id="edge1_Node000001_Node000001" class="edge">
|
||||
<title>Node1->Node1</title>
|
||||
<g id="a_edge1_Node000001_Node000001"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M15.54,-19.54C12.31,-28.15 14.67,-37.25 22.62,-37.25 26.85,-37.25 29.5,-34.68 30.57,-30.98"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="34.06,-30.76 29.82,-21.05 27.08,-31.28 34.06,-30.76"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.3 KiB |
@@ -1,17 +0,0 @@
|
||||
<map id="main" name="main">
|
||||
<area shape="rect" id="Node000001" title="Main function." alt="" coords="5,104,55,130"/>
|
||||
<area shape="rect" id="Node000002" href="$d2/d45/segtree_8cpp.html#ae752659b7c1719d68fdb2ca538a93696" title="for std::vector" alt="" coords="194,29,272,55"/>
|
||||
<area shape="poly" id="edge1_Node000001_Node000002" title=" " alt="" coords="44,101,70,82,102,64,140,51,178,44,179,49,141,57,104,69,73,86,48,106"/>
|
||||
<area shape="rect" id="Node000003" href="$d2/d45/segtree_8cpp.html#a423a97ea0c7ea6e33b5844a6858d902d" title="Returns the sum of all elements in a range." alt="" coords="206,103,260,128"/>
|
||||
<area shape="poly" id="edge3_Node000001_Node000003" title=" " alt="" coords="55,114,146,114,191,114,191,119,146,119,55,120"/>
|
||||
<area shape="rect" id="Node000004" href="$d2/d45/segtree_8cpp.html#aa8dca7b867074164d5f45b0f3851269d" title="Self-test implementation." alt="" coords="103,79,146,104"/>
|
||||
<area shape="poly" id="edge5_Node000001_Node000004" title=" " alt="" coords="54,108,87,99,88,104,56,113"/>
|
||||
<area shape="rect" id="Node000005" href="$d2/d45/segtree_8cpp.html#abd3e818681fb2e29cf08f4f60f82c8e0" title="Updates a range of the segment tree." alt="" coords="203,177,263,203"/>
|
||||
<area shape="poly" id="edge10_Node000001_Node000005" title=" " alt="" coords="56,123,189,172,188,177,54,128"/>
|
||||
<area shape="poly" id="edge2_Node000002_Node000002" title=" " alt="" coords="214,30,210,21,212,11,220,5,233,3,247,5,254,12,251,16,245,10,233,8,222,10,217,14,215,20,219,28"/>
|
||||
<area shape="poly" id="edge4_Node000003_Node000003" title=" " alt="" coords="214,103,210,94,212,85,220,78,233,76,247,79,254,86,251,89,245,83,233,81,222,83,217,88,215,94,219,101"/>
|
||||
<area shape="poly" id="edge6_Node000004_Node000002" title=" " alt="" coords="146,79,188,60,190,64,148,84"/>
|
||||
<area shape="poly" id="edge7_Node000004_Node000003" title=" " alt="" coords="147,94,192,104,191,109,146,99"/>
|
||||
<area shape="poly" id="edge8_Node000004_Node000005" title=" " alt="" coords="142,103,208,164,204,168,138,107"/>
|
||||
<area shape="poly" id="edge9_Node000005_Node000005" title=" " alt="" coords="214,178,210,169,212,159,220,153,233,151,247,153,254,160,251,164,245,158,233,156,222,158,217,162,215,168,219,176"/>
|
||||
</map>
|
||||
@@ -1 +0,0 @@
|
||||
67332d76b842788ad2c01c9d0b1410a8
|
||||
@@ -1,173 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
|
||||
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<!-- Generated by graphviz version 12.1.2 (20240928.0832)
|
||||
-->
|
||||
<!-- Title: main Pages: 1 -->
|
||||
<svg width="208pt" height="156pt"
|
||||
viewBox="0.00 0.00 208.25 156.25" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
|
||||
<svg id="main" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve">
|
||||
|
||||
<style type="text/css"><![CDATA[
|
||||
.node, .edge {opacity: 0.7;}
|
||||
.node.selected, .edge.selected {opacity: 1;}
|
||||
.edge:hover path { stroke: red; }
|
||||
.edge:hover polygon { stroke: red; fill: red; }
|
||||
]]></style>
|
||||
<script type="application/ecmascript" xlink:href="../../svg.min.js"/>
|
||||
<svg id="graph" class="graph">
|
||||
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 152.25)">
|
||||
<title>main</title>
|
||||
<!-- Node1 -->
|
||||
<g id="Node000001" class="node">
|
||||
<title>Node1</title>
|
||||
<g id="a_Node000001"><a xlink:title="Main function.">
|
||||
<polygon fill="#999999" stroke="#666666" points="37,-74.25 0,-74.25 0,-55 37,-55 37,-74.25"/>
|
||||
<text text-anchor="middle" x="18.5" y="-60.75" font-family="Helvetica,sans-Serif" font-size="10.00">main</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node2 -->
|
||||
<g id="Node000002" class="node">
|
||||
<title>Node2</title>
|
||||
<g id="a_Node000002"><a xlink:href="../../d2/d45/segtree_8cpp.html#ae752659b7c1719d68fdb2ca538a93696" target="_top" xlink:title="for std::vector">
|
||||
<polygon fill="white" stroke="#666666" points="200.25,-130.25 141.5,-130.25 141.5,-111 200.25,-111 200.25,-130.25"/>
|
||||
<text text-anchor="middle" x="170.88" y="-116.75" font-family="Helvetica,sans-Serif" font-size="10.00">ConsTree</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node1->Node2 -->
|
||||
<g id="edge1_Node000001_Node000002" class="edge">
|
||||
<title>Node1->Node2</title>
|
||||
<g id="a_edge1_Node000001_Node000002"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M30.52,-74.66C40.77,-83.42 56.84,-95.78 73,-102.62 90.96,-110.23 112.14,-114.63 130.11,-117.18"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="129.53,-120.63 139.88,-118.4 130.4,-113.69 129.53,-120.63"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node3 -->
|
||||
<g id="Node000003" class="node">
|
||||
<title>Node3</title>
|
||||
<g id="a_Node000003"><a xlink:href="../../d2/d45/segtree_8cpp.html#a423a97ea0c7ea6e33b5844a6858d902d" target="_top" xlink:title="Returns the sum of all elements in a range.">
|
||||
<polygon fill="white" stroke="#666666" points="190.88,-75.25 150.88,-75.25 150.88,-56 190.88,-56 190.88,-75.25"/>
|
||||
<text text-anchor="middle" x="170.88" y="-61.75" font-family="Helvetica,sans-Serif" font-size="10.00">query</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node1->Node3 -->
|
||||
<g id="edge3_Node000001_Node000003" class="edge">
|
||||
<title>Node1->Node3</title>
|
||||
<g id="a_edge3_Node000001_Node000003"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M37.29,-64.54C54.68,-64.48 81.91,-64.44 105.5,-64.62 116.46,-64.71 128.48,-64.88 139.12,-65.05"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="138.87,-68.55 148.92,-65.22 138.99,-61.55 138.87,-68.55"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node4 -->
|
||||
<g id="Node000004" class="node">
|
||||
<title>Node4</title>
|
||||
<g id="a_Node000004"><a xlink:href="../../d2/d45/segtree_8cpp.html#aa8dca7b867074164d5f45b0f3851269d" target="_top" xlink:title="Self-test implementation.">
|
||||
<polygon fill="white" stroke="#666666" points="105.5,-93.25 73,-93.25 73,-74 105.5,-74 105.5,-93.25"/>
|
||||
<text text-anchor="middle" x="89.25" y="-79.75" font-family="Helvetica,sans-Serif" font-size="10.00">test</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node1->Node4 -->
|
||||
<g id="edge5_Node000001_Node000004" class="edge">
|
||||
<title>Node1->Node4</title>
|
||||
<g id="a_edge5_Node000001_Node000004"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M37.2,-69.52C44.67,-71.58 53.52,-74.03 61.73,-76.3"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="60.68,-79.64 71.25,-78.93 62.55,-72.89 60.68,-79.64"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node5 -->
|
||||
<g id="Node000005" class="node">
|
||||
<title>Node5</title>
|
||||
<g id="a_Node000005"><a xlink:href="../../d2/d45/segtree_8cpp.html#abd3e818681fb2e29cf08f4f60f82c8e0" target="_top" xlink:title="Updates a range of the segment tree.">
|
||||
<polygon fill="white" stroke="#666666" points="193.5,-19.25 148.25,-19.25 148.25,0 193.5,0 193.5,-19.25"/>
|
||||
<text text-anchor="middle" x="170.88" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">update</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node1->Node5 -->
|
||||
<g id="edge10_Node000001_Node000005" class="edge">
|
||||
<title>Node1->Node5</title>
|
||||
<g id="a_edge10_Node000001_Node000005"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M37.34,-58.1C61.94,-49.1 106.7,-32.73 137.34,-21.53"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="138.31,-24.9 146.5,-18.17 135.91,-18.32 138.31,-24.9"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node2->Node2 -->
|
||||
<g id="edge2_Node000002_Node000002" class="edge">
|
||||
<title>Node2->Node2</title>
|
||||
<g id="a_edge2_Node000002_Node000002"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M158.1,-130.54C152.27,-139.15 156.53,-148.25 170.88,-148.25 178.72,-148.25 183.55,-145.53 185.36,-141.65"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="188.86,-141.39 183.88,-132.03 181.95,-142.45 188.86,-141.39"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node3->Node3 -->
|
||||
<g id="edge4_Node000003_Node000003" class="edge">
|
||||
<title>Node3->Node3</title>
|
||||
<g id="a_edge4_Node000003_Node000003"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M158.1,-75.54C152.27,-84.15 156.53,-93.25 170.88,-93.25 178.72,-93.25 183.55,-90.53 185.36,-86.65"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="188.86,-86.39 183.88,-77.03 181.95,-87.45 188.86,-86.39"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node4->Node2 -->
|
||||
<g id="edge6_Node000004_Node000002" class="edge">
|
||||
<title>Node4->Node2</title>
|
||||
<g id="a_edge6_Node000004_Node000002"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M105.98,-90.94C115.12,-95.18 126.96,-100.68 137.97,-105.8"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="136.23,-108.85 146.78,-109.89 139.18,-102.5 136.23,-108.85"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node4->Node3 -->
|
||||
<g id="edge7_Node000004_Node000003" class="edge">
|
||||
<title>Node4->Node3</title>
|
||||
<g id="a_edge7_Node000004_Node000003"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M105.98,-80.07C115.57,-77.9 128.14,-75.06 139.59,-72.47"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="140.06,-75.95 149.04,-70.34 138.51,-69.13 140.06,-75.95"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node4->Node5 -->
|
||||
<g id="edge8_Node000004_Node000005" class="edge">
|
||||
<title>Node4->Node5</title>
|
||||
<g id="a_edge8_Node000004_Node000005"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M100.99,-73.65C113.69,-61.84 135.08,-41.96 150.66,-27.48"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="153,-30.08 157.94,-20.71 148.24,-24.96 153,-30.08"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node5->Node5 -->
|
||||
<g id="edge9_Node000005_Node000005" class="edge">
|
||||
<title>Node5->Node5</title>
|
||||
<g id="a_edge9_Node000005_Node000005"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M158.1,-19.54C152.27,-28.15 156.53,-37.25 170.88,-37.25 178.72,-37.25 183.55,-34.53 185.36,-30.65"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="188.86,-30.39 183.88,-21.03 181.95,-31.45 188.86,-30.39"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
</svg>
|
||||
|
||||
<style type='text/css'>
|
||||
<![CDATA[
|
||||
[data-mouse-over-selected='false'] { opacity: 0.7; }
|
||||
[data-mouse-over-selected='true'] { opacity: 1.0; }
|
||||
]]>
|
||||
</style>
|
||||
<script type="application/ecmascript"><![CDATA[
|
||||
document.addEventListener('DOMContentLoaded', (event) => {
|
||||
highlightEdges();
|
||||
highlightAdjacentNodes();
|
||||
});
|
||||
]]></script>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 7.5 KiB |
@@ -1,147 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
|
||||
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<!-- Generated by graphviz version 12.1.2 (20240928.0832)
|
||||
-->
|
||||
<!-- Title: main Pages: 1 -->
|
||||
<svg width="208pt" height="156pt"
|
||||
viewBox="0.00 0.00 208.25 156.25" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 152.25)">
|
||||
<title>main</title>
|
||||
<!-- Node1 -->
|
||||
<g id="Node000001" class="node">
|
||||
<title>Node1</title>
|
||||
<g id="a_Node000001"><a xlink:title="Main function.">
|
||||
<polygon fill="#999999" stroke="#666666" points="37,-74.25 0,-74.25 0,-55 37,-55 37,-74.25"/>
|
||||
<text text-anchor="middle" x="18.5" y="-60.75" font-family="Helvetica,sans-Serif" font-size="10.00">main</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node2 -->
|
||||
<g id="Node000002" class="node">
|
||||
<title>Node2</title>
|
||||
<g id="a_Node000002"><a xlink:href="../../d2/d45/segtree_8cpp.html#ae752659b7c1719d68fdb2ca538a93696" target="_top" xlink:title="for std::vector">
|
||||
<polygon fill="white" stroke="#666666" points="200.25,-130.25 141.5,-130.25 141.5,-111 200.25,-111 200.25,-130.25"/>
|
||||
<text text-anchor="middle" x="170.88" y="-116.75" font-family="Helvetica,sans-Serif" font-size="10.00">ConsTree</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node1->Node2 -->
|
||||
<g id="edge1_Node000001_Node000002" class="edge">
|
||||
<title>Node1->Node2</title>
|
||||
<g id="a_edge1_Node000001_Node000002"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M30.52,-74.66C40.77,-83.42 56.84,-95.78 73,-102.62 90.96,-110.23 112.14,-114.63 130.11,-117.18"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="129.53,-120.63 139.88,-118.4 130.4,-113.69 129.53,-120.63"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node3 -->
|
||||
<g id="Node000003" class="node">
|
||||
<title>Node3</title>
|
||||
<g id="a_Node000003"><a xlink:href="../../d2/d45/segtree_8cpp.html#a423a97ea0c7ea6e33b5844a6858d902d" target="_top" xlink:title="Returns the sum of all elements in a range.">
|
||||
<polygon fill="white" stroke="#666666" points="190.88,-75.25 150.88,-75.25 150.88,-56 190.88,-56 190.88,-75.25"/>
|
||||
<text text-anchor="middle" x="170.88" y="-61.75" font-family="Helvetica,sans-Serif" font-size="10.00">query</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node1->Node3 -->
|
||||
<g id="edge3_Node000001_Node000003" class="edge">
|
||||
<title>Node1->Node3</title>
|
||||
<g id="a_edge3_Node000001_Node000003"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M37.29,-64.54C54.68,-64.48 81.91,-64.44 105.5,-64.62 116.46,-64.71 128.48,-64.88 139.12,-65.05"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="138.87,-68.55 148.92,-65.22 138.99,-61.55 138.87,-68.55"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node4 -->
|
||||
<g id="Node000004" class="node">
|
||||
<title>Node4</title>
|
||||
<g id="a_Node000004"><a xlink:href="../../d2/d45/segtree_8cpp.html#aa8dca7b867074164d5f45b0f3851269d" target="_top" xlink:title="Self-test implementation.">
|
||||
<polygon fill="white" stroke="#666666" points="105.5,-93.25 73,-93.25 73,-74 105.5,-74 105.5,-93.25"/>
|
||||
<text text-anchor="middle" x="89.25" y="-79.75" font-family="Helvetica,sans-Serif" font-size="10.00">test</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node1->Node4 -->
|
||||
<g id="edge5_Node000001_Node000004" class="edge">
|
||||
<title>Node1->Node4</title>
|
||||
<g id="a_edge5_Node000001_Node000004"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M37.2,-69.52C44.67,-71.58 53.52,-74.03 61.73,-76.3"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="60.68,-79.64 71.25,-78.93 62.55,-72.89 60.68,-79.64"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node5 -->
|
||||
<g id="Node000005" class="node">
|
||||
<title>Node5</title>
|
||||
<g id="a_Node000005"><a xlink:href="../../d2/d45/segtree_8cpp.html#abd3e818681fb2e29cf08f4f60f82c8e0" target="_top" xlink:title="Updates a range of the segment tree.">
|
||||
<polygon fill="white" stroke="#666666" points="193.5,-19.25 148.25,-19.25 148.25,0 193.5,0 193.5,-19.25"/>
|
||||
<text text-anchor="middle" x="170.88" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">update</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node1->Node5 -->
|
||||
<g id="edge10_Node000001_Node000005" class="edge">
|
||||
<title>Node1->Node5</title>
|
||||
<g id="a_edge10_Node000001_Node000005"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M37.34,-58.1C61.94,-49.1 106.7,-32.73 137.34,-21.53"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="138.31,-24.9 146.5,-18.17 135.91,-18.32 138.31,-24.9"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node2->Node2 -->
|
||||
<g id="edge2_Node000002_Node000002" class="edge">
|
||||
<title>Node2->Node2</title>
|
||||
<g id="a_edge2_Node000002_Node000002"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M158.1,-130.54C152.27,-139.15 156.53,-148.25 170.88,-148.25 178.72,-148.25 183.55,-145.53 185.36,-141.65"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="188.86,-141.39 183.88,-132.03 181.95,-142.45 188.86,-141.39"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node3->Node3 -->
|
||||
<g id="edge4_Node000003_Node000003" class="edge">
|
||||
<title>Node3->Node3</title>
|
||||
<g id="a_edge4_Node000003_Node000003"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M158.1,-75.54C152.27,-84.15 156.53,-93.25 170.88,-93.25 178.72,-93.25 183.55,-90.53 185.36,-86.65"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="188.86,-86.39 183.88,-77.03 181.95,-87.45 188.86,-86.39"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node4->Node2 -->
|
||||
<g id="edge6_Node000004_Node000002" class="edge">
|
||||
<title>Node4->Node2</title>
|
||||
<g id="a_edge6_Node000004_Node000002"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M105.98,-90.94C115.12,-95.18 126.96,-100.68 137.97,-105.8"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="136.23,-108.85 146.78,-109.89 139.18,-102.5 136.23,-108.85"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node4->Node3 -->
|
||||
<g id="edge7_Node000004_Node000003" class="edge">
|
||||
<title>Node4->Node3</title>
|
||||
<g id="a_edge7_Node000004_Node000003"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M105.98,-80.07C115.57,-77.9 128.14,-75.06 139.59,-72.47"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="140.06,-75.95 149.04,-70.34 138.51,-69.13 140.06,-75.95"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node4->Node5 -->
|
||||
<g id="edge8_Node000004_Node000005" class="edge">
|
||||
<title>Node4->Node5</title>
|
||||
<g id="a_edge8_Node000004_Node000005"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M100.99,-73.65C113.69,-61.84 135.08,-41.96 150.66,-27.48"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="153,-30.08 157.94,-20.71 148.24,-24.96 153,-30.08"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node5->Node5 -->
|
||||
<g id="edge9_Node000005_Node000005" class="edge">
|
||||
<title>Node5->Node5</title>
|
||||
<g id="a_edge9_Node000005_Node000005"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M158.1,-19.54C152.27,-28.15 156.53,-37.25 170.88,-37.25 178.72,-37.25 183.55,-34.53 185.36,-30.65"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="188.86,-30.39 183.88,-21.03 181.95,-31.45 188.86,-30.39"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 6.7 KiB |
@@ -1,4 +0,0 @@
|
||||
<map id="ConsTree" name="ConsTree">
|
||||
<area shape="rect" id="Node000001" title="for std::vector" alt="" coords="5,29,84,55"/>
|
||||
<area shape="poly" id="edge1_Node000001_Node000001" title=" " alt="" coords="30,29,29,12,35,5,45,3,55,5,60,12,56,15,52,10,44,8,37,10,34,14,35,29"/>
|
||||
</map>
|
||||
@@ -1 +0,0 @@
|
||||
f00a82031718d136ff74e99fcc9e0f2f
|
||||
@@ -1,56 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
|
||||
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<!-- Generated by graphviz version 12.1.2 (20240928.0832)
|
||||
-->
|
||||
<!-- Title: ConsTree Pages: 1 -->
|
||||
<svg width="67pt" height="45pt"
|
||||
viewBox="0.00 0.00 66.75 45.25" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
|
||||
<svg id="main" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve">
|
||||
|
||||
<style type="text/css"><![CDATA[
|
||||
.node, .edge {opacity: 0.7;}
|
||||
.node.selected, .edge.selected {opacity: 1;}
|
||||
.edge:hover path { stroke: red; }
|
||||
.edge:hover polygon { stroke: red; fill: red; }
|
||||
]]></style>
|
||||
<script type="application/ecmascript" xlink:href="../../svg.min.js"/>
|
||||
<svg id="graph" class="graph">
|
||||
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 41.25)">
|
||||
<title>ConsTree</title>
|
||||
<!-- Node1 -->
|
||||
<g id="Node000001" class="node">
|
||||
<title>Node1</title>
|
||||
<g id="a_Node000001"><a xlink:title="for std::vector">
|
||||
<polygon fill="#999999" stroke="#666666" points="58.75,-19.25 0,-19.25 0,0 58.75,0 58.75,-19.25"/>
|
||||
<text text-anchor="middle" x="29.38" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">ConsTree</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node1->Node1 -->
|
||||
<g id="edge1_Node000001_Node000001" class="edge">
|
||||
<title>Node1->Node1</title>
|
||||
<g id="a_edge1_Node000001_Node000001"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M20.18,-19.54C15.98,-28.15 19.05,-37.25 29.38,-37.25 34.86,-37.25 38.3,-34.68 39.69,-30.98"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="43.17,-30.66 38.72,-21.04 36.2,-31.34 43.17,-30.66"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
</svg>
|
||||
|
||||
<style type='text/css'>
|
||||
<![CDATA[
|
||||
[data-mouse-over-selected='false'] { opacity: 0.7; }
|
||||
[data-mouse-over-selected='true'] { opacity: 1.0; }
|
||||
]]>
|
||||
</style>
|
||||
<script type="application/ecmascript"><![CDATA[
|
||||
document.addEventListener('DOMContentLoaded', (event) => {
|
||||
highlightEdges();
|
||||
highlightAdjacentNodes();
|
||||
});
|
||||
]]></script>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 2.0 KiB |
@@ -1,30 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
|
||||
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<!-- Generated by graphviz version 12.1.2 (20240928.0832)
|
||||
-->
|
||||
<!-- Title: ConsTree Pages: 1 -->
|
||||
<svg width="67pt" height="45pt"
|
||||
viewBox="0.00 0.00 66.75 45.25" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 41.25)">
|
||||
<title>ConsTree</title>
|
||||
<!-- Node1 -->
|
||||
<g id="Node000001" class="node">
|
||||
<title>Node1</title>
|
||||
<g id="a_Node000001"><a xlink:title="for std::vector">
|
||||
<polygon fill="#999999" stroke="#666666" points="58.75,-19.25 0,-19.25 0,0 58.75,0 58.75,-19.25"/>
|
||||
<text text-anchor="middle" x="29.38" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">ConsTree</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node1->Node1 -->
|
||||
<g id="edge1_Node000001_Node000001" class="edge">
|
||||
<title>Node1->Node1</title>
|
||||
<g id="a_edge1_Node000001_Node000001"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M20.18,-19.54C15.98,-28.15 19.05,-37.25 29.38,-37.25 34.86,-37.25 38.3,-34.68 39.69,-30.98"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="43.17,-30.66 38.72,-21.04 36.2,-31.34 43.17,-30.66"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.3 KiB |
306
d2/d45/segtree_8cpp_source.html
Normal file
@@ -0,0 +1,306 @@
|
||||
<!-- HTML header for doxygen 1.12.0-->
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.12.0"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>TheAlgorithms/C++: range_queries/segtree.cpp Source File</title>
|
||||
<link rel="icon" href="../../favicon.svg" type="image/x-icon" />
|
||||
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="../../jquery.js"></script>
|
||||
<script type="text/javascript" src="../../dynsections.js"></script>
|
||||
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@xpack-3rd-party/doxygen-awesome-css@2.2.0-1/doxygen-awesome-darkmode-toggle.js"></script>
|
||||
<script type="text/javascript">
|
||||
DoxygenAwesomeDarkModeToggle.init()
|
||||
</script>
|
||||
<script type="text/javascript" src="../../clipboard.js"></script>
|
||||
<link href="../../navtree.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="../../navtreedata.js"></script>
|
||||
<script type="text/javascript" src="../../navtree.js"></script>
|
||||
<script type="text/javascript" src="../../resize.js"></script>
|
||||
<script type="text/javascript" src="../../cookie.js"></script>
|
||||
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="../../search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="../../search/search.js"></script>
|
||||
<script type="text/javascript">
|
||||
window.MathJax = {
|
||||
options: {
|
||||
ignoreHtmlClass: 'tex2jax_ignore',
|
||||
processHtmlClass: 'tex2jax_process'
|
||||
},
|
||||
loader: {
|
||||
load: ['[tex]/ams']
|
||||
},
|
||||
tex: {
|
||||
macros: {},
|
||||
packages: ['base','configmacros','ams']
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script type="text/javascript" id="MathJax-script" async="async" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js"></script>
|
||||
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
|
||||
<link href="../../doxygen-awesome.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
<div id="titlearea">
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr id="projectrow">
|
||||
<td id="projectlogo"><img alt="Logo" src="../../project_logo.png"/></td>
|
||||
<td id="projectalign">
|
||||
<div id="projectname">TheAlgorithms/C++<span id="projectnumber"> 1.0.0</span>
|
||||
</div>
|
||||
<div id="projectbrief">All the algorithms implemented in C++</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.12.0 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "../../search/",'.html');
|
||||
/* @license-end */
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(function() { codefold.init(1); });
|
||||
/* @license-end */
|
||||
</script>
|
||||
<script type="text/javascript" src="../../menudata.js"></script>
|
||||
<script type="text/javascript" src="../../menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(function() {
|
||||
initMenu('../../',true,false,'search.php','Search',true);
|
||||
$(function() { init_search(); });
|
||||
});
|
||||
/* @license-end */
|
||||
</script>
|
||||
<div id="main-nav"></div>
|
||||
</div><!-- top -->
|
||||
<div id="side-nav" class="ui-resizable side-nav-resizable">
|
||||
<div id="nav-tree">
|
||||
<div id="nav-tree-contents">
|
||||
<div id="nav-sync" class="sync"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="splitbar" style="-moz-user-select:none;"
|
||||
class="ui-resizable-handle">
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(function(){initNavTree('d2/d45/segtree_8cpp_source.html','../../'); initResizable(true); });
|
||||
/* @license-end */
|
||||
</script>
|
||||
<div id="doc-content">
|
||||
<!-- window showing the filter options -->
|
||||
<div id="MSearchSelectWindow"
|
||||
onmouseover="return searchBox.OnSearchSelectShow()"
|
||||
onmouseout="return searchBox.OnSearchSelectHide()"
|
||||
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
||||
</div>
|
||||
|
||||
<!-- iframe showing the search results (closed by default) -->
|
||||
<div id="MSearchResultsWindow">
|
||||
<div id="MSearchResults">
|
||||
<div class="SRPage">
|
||||
<div id="SRIndex">
|
||||
<div id="SRResults"></div>
|
||||
<div class="SRStatus" id="Loading">Loading...</div>
|
||||
<div class="SRStatus" id="Searching">Searching...</div>
|
||||
<div class="SRStatus" id="NoMatches">No Matches</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="header">
|
||||
<div class="headertitle"><div class="title">segtree.cpp</div></div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
<a href="../../d2/d45/segtree_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span> </div>
|
||||
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span><span class="preprocessor">#include <cassert></span> </div>
|
||||
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span><span class="preprocessor">#include <cmath></span> </div>
|
||||
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span><span class="preprocessor">#include <cstdint></span> </div>
|
||||
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span><span class="preprocessor">#include <iostream></span> </div>
|
||||
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span><span class="preprocessor">#include <vector></span> </div>
|
||||
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span> </div>
|
||||
<div class="foldopen" id="foldopen00038" data-start="{" data-end="}">
|
||||
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"><a class="line" href="../../d2/d45/segtree_8cpp.html#ae752659b7c1719d68fdb2ca538a93696"> 38</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="../../d2/d45/segtree_8cpp.html#ae752659b7c1719d68fdb2ca538a93696">ConsTree</a>(<span class="keyword">const</span> std::vector<int64_t> &arr, std::vector<int64_t> *segtree,</div>
|
||||
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span> uint64_t low, uint64_t high, uint64_t pos) {</div>
|
||||
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span> <span class="keywordflow">if</span> (low == high) {</div>
|
||||
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span> (*segtree)[pos] = arr[low];</div>
|
||||
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span> <span class="keywordflow">return</span>;</div>
|
||||
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span> }</div>
|
||||
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span> </div>
|
||||
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span> uint64_t mid = (low + high) / 2;</div>
|
||||
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span> <a class="code hl_function" href="../../d2/d45/segtree_8cpp.html#ae752659b7c1719d68fdb2ca538a93696">ConsTree</a>(arr, segtree, low, mid, 2 * pos + 1);</div>
|
||||
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span> <a class="code hl_function" href="../../d2/d45/segtree_8cpp.html#ae752659b7c1719d68fdb2ca538a93696">ConsTree</a>(arr, segtree, mid + 1, high, 2 * pos + 2);</div>
|
||||
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> (*segtree)[pos] = (*segtree)[2 * pos + 1] + (*segtree)[2 * pos + 2];</div>
|
||||
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span>}</div>
|
||||
</div>
|
||||
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span> </div>
|
||||
<div class="foldopen" id="foldopen00063" data-start="{" data-end="}">
|
||||
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"><a class="line" href="../../d2/d45/segtree_8cpp.html#a423a97ea0c7ea6e33b5844a6858d902d"> 63</a></span>int64_t <a class="code hl_function" href="../../d2/d45/segtree_8cpp.html#a423a97ea0c7ea6e33b5844a6858d902d">query</a>(std::vector<int64_t> *segtree, std::vector<int64_t> *lazy,</div>
|
||||
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span> uint64_t qlow, uint64_t qhigh, uint64_t low, uint64_t high,</div>
|
||||
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span> uint64_t pos) {</div>
|
||||
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span> <span class="keywordflow">if</span> (low > high || qlow > high || low > qhigh) {</div>
|
||||
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"> 67</span> <span class="keywordflow">return</span> 0;</div>
|
||||
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span> }</div>
|
||||
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"> 69</span> </div>
|
||||
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span> <span class="keywordflow">if</span> ((*lazy)[pos] != 0) {</div>
|
||||
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span> (*segtree)[pos] += (*lazy)[pos] * (high - low + 1);</div>
|
||||
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"> 72</span> </div>
|
||||
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span> <span class="keywordflow">if</span> (low != high) {</div>
|
||||
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span> (*lazy)[2 * pos + 1] += (*lazy)[pos];</div>
|
||||
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno"> 75</span> (*lazy)[2 * pos + 2] += (*lazy)[pos];</div>
|
||||
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"> 76</span> }</div>
|
||||
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span> (*lazy)[pos] = 0;</div>
|
||||
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> }</div>
|
||||
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> </div>
|
||||
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span> <span class="keywordflow">if</span> (qlow <= low && qhigh >= high) {</div>
|
||||
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"> 81</span> <span class="keywordflow">return</span> (*segtree)[pos];</div>
|
||||
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno"> 82</span> }</div>
|
||||
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno"> 83</span> </div>
|
||||
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno"> 84</span> uint64_t mid = (low + high) / 2;</div>
|
||||
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno"> 85</span> </div>
|
||||
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno"> 86</span> <span class="keywordflow">return</span> <a class="code hl_function" href="../../d2/d45/segtree_8cpp.html#a423a97ea0c7ea6e33b5844a6858d902d">query</a>(segtree, lazy, qlow, qhigh, low, mid, 2 * pos + 1) +</div>
|
||||
<div class="line"><a id="l00087" name="l00087"></a><span class="lineno"> 87</span> <a class="code hl_function" href="../../d2/d45/segtree_8cpp.html#a423a97ea0c7ea6e33b5844a6858d902d">query</a>(segtree, lazy, qlow, qhigh, mid + 1, high, 2 * pos + 2);</div>
|
||||
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"> 88</span>}</div>
|
||||
</div>
|
||||
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span> </div>
|
||||
<div class="foldopen" id="foldopen00103" data-start="{" data-end="}">
|
||||
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno"><a class="line" href="../../d2/d45/segtree_8cpp.html#abd3e818681fb2e29cf08f4f60f82c8e0"> 103</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="../../d2/d45/segtree_8cpp.html#abd3e818681fb2e29cf08f4f60f82c8e0">update</a>(std::vector<int64_t> *segtree, std::vector<int64_t> *lazy,</div>
|
||||
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno"> 104</span> int64_t start, int64_t end, int64_t delta, uint64_t low,</div>
|
||||
<div class="line"><a id="l00105" name="l00105"></a><span class="lineno"> 105</span> uint64_t high, uint64_t pos) {</div>
|
||||
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno"> 106</span> <span class="keywordflow">if</span> (low > high) {</div>
|
||||
<div class="line"><a id="l00107" name="l00107"></a><span class="lineno"> 107</span> <span class="keywordflow">return</span>;</div>
|
||||
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno"> 108</span> }</div>
|
||||
<div class="line"><a id="l00109" name="l00109"></a><span class="lineno"> 109</span> </div>
|
||||
<div class="line"><a id="l00110" name="l00110"></a><span class="lineno"> 110</span> <span class="keywordflow">if</span> ((*lazy)[pos] != 0) {</div>
|
||||
<div class="line"><a id="l00111" name="l00111"></a><span class="lineno"> 111</span> (*segtree)[pos] += (*lazy)[pos] * (high - low + 1);</div>
|
||||
<div class="line"><a id="l00112" name="l00112"></a><span class="lineno"> 112</span> </div>
|
||||
<div class="line"><a id="l00113" name="l00113"></a><span class="lineno"> 113</span> <span class="keywordflow">if</span> (low != high) {</div>
|
||||
<div class="line"><a id="l00114" name="l00114"></a><span class="lineno"> 114</span> (*lazy)[2 * pos + 1] += (*lazy)[pos];</div>
|
||||
<div class="line"><a id="l00115" name="l00115"></a><span class="lineno"> 115</span> (*lazy)[2 * pos + 2] += (*lazy)[pos];</div>
|
||||
<div class="line"><a id="l00116" name="l00116"></a><span class="lineno"> 116</span> }</div>
|
||||
<div class="line"><a id="l00117" name="l00117"></a><span class="lineno"> 117</span> (*lazy)[pos] = 0;</div>
|
||||
<div class="line"><a id="l00118" name="l00118"></a><span class="lineno"> 118</span> }</div>
|
||||
<div class="line"><a id="l00119" name="l00119"></a><span class="lineno"> 119</span> </div>
|
||||
<div class="line"><a id="l00120" name="l00120"></a><span class="lineno"> 120</span> <span class="keywordflow">if</span> (start > high || end < low) {</div>
|
||||
<div class="line"><a id="l00121" name="l00121"></a><span class="lineno"> 121</span> <span class="keywordflow">return</span>;</div>
|
||||
<div class="line"><a id="l00122" name="l00122"></a><span class="lineno"> 122</span> }</div>
|
||||
<div class="line"><a id="l00123" name="l00123"></a><span class="lineno"> 123</span> </div>
|
||||
<div class="line"><a id="l00124" name="l00124"></a><span class="lineno"> 124</span> <span class="keywordflow">if</span> (start <= low && end >= high) {</div>
|
||||
<div class="line"><a id="l00125" name="l00125"></a><span class="lineno"> 125</span> (*segtree)[pos] += delta * (high - low + 1);</div>
|
||||
<div class="line"><a id="l00126" name="l00126"></a><span class="lineno"> 126</span> </div>
|
||||
<div class="line"><a id="l00127" name="l00127"></a><span class="lineno"> 127</span> <span class="keywordflow">if</span> (low != high) {</div>
|
||||
<div class="line"><a id="l00128" name="l00128"></a><span class="lineno"> 128</span> (*lazy)[2 * pos + 1] += delta;</div>
|
||||
<div class="line"><a id="l00129" name="l00129"></a><span class="lineno"> 129</span> (*lazy)[2 * pos + 2] += delta;</div>
|
||||
<div class="line"><a id="l00130" name="l00130"></a><span class="lineno"> 130</span> }</div>
|
||||
<div class="line"><a id="l00131" name="l00131"></a><span class="lineno"> 131</span> </div>
|
||||
<div class="line"><a id="l00132" name="l00132"></a><span class="lineno"> 132</span> <span class="keywordflow">return</span>;</div>
|
||||
<div class="line"><a id="l00133" name="l00133"></a><span class="lineno"> 133</span> }</div>
|
||||
<div class="line"><a id="l00134" name="l00134"></a><span class="lineno"> 134</span> </div>
|
||||
<div class="line"><a id="l00135" name="l00135"></a><span class="lineno"> 135</span> uint64_t mid = (low + high) / 2;</div>
|
||||
<div class="line"><a id="l00136" name="l00136"></a><span class="lineno"> 136</span> </div>
|
||||
<div class="line"><a id="l00137" name="l00137"></a><span class="lineno"> 137</span> <a class="code hl_function" href="../../d2/d45/segtree_8cpp.html#abd3e818681fb2e29cf08f4f60f82c8e0">update</a>(segtree, lazy, start, end, delta, low, mid, 2 * pos + 1);</div>
|
||||
<div class="line"><a id="l00138" name="l00138"></a><span class="lineno"> 138</span> <a class="code hl_function" href="../../d2/d45/segtree_8cpp.html#abd3e818681fb2e29cf08f4f60f82c8e0">update</a>(segtree, lazy, start, end, delta, mid + 1, high, 2 * pos + 2);</div>
|
||||
<div class="line"><a id="l00139" name="l00139"></a><span class="lineno"> 139</span> (*segtree)[pos] = (*segtree)[2 * pos + 1] + (*segtree)[2 * pos + 2];</div>
|
||||
<div class="line"><a id="l00140" name="l00140"></a><span class="lineno"> 140</span>}</div>
|
||||
</div>
|
||||
<div class="line"><a id="l00141" name="l00141"></a><span class="lineno"> 141</span> </div>
|
||||
<div class="foldopen" id="foldopen00147" data-start="{" data-end="}">
|
||||
<div class="line"><a id="l00147" name="l00147"></a><span class="lineno"><a class="line" href="../../d2/d45/segtree_8cpp.html#aa8dca7b867074164d5f45b0f3851269d"> 147</a></span><span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../d2/d45/segtree_8cpp.html#aa8dca7b867074164d5f45b0f3851269d">test</a>() {</div>
|
||||
<div class="line"><a id="l00148" name="l00148"></a><span class="lineno"> 148</span> <span class="keyword">auto</span> max = <span class="keyword">static_cast<</span>int64_t<span class="keyword">></span>(2 * pow(2, ceil(log2(7))) - 1);</div>
|
||||
<div class="line"><a id="l00149" name="l00149"></a><span class="lineno"> 149</span> assert(max == 15);</div>
|
||||
<div class="line"><a id="l00150" name="l00150"></a><span class="lineno"> 150</span> </div>
|
||||
<div class="line"><a id="l00151" name="l00151"></a><span class="lineno"> 151</span> std::vector<int64_t> arr{1, 2, 3, 4, 5, 6, 7}, lazy(max), segtree(max);</div>
|
||||
<div class="line"><a id="l00152" name="l00152"></a><span class="lineno"> 152</span> <a class="code hl_function" href="../../d2/d45/segtree_8cpp.html#ae752659b7c1719d68fdb2ca538a93696">ConsTree</a>(arr, &segtree, 0, 7 - 1, 0);</div>
|
||||
<div class="line"><a id="l00153" name="l00153"></a><span class="lineno"> 153</span> </div>
|
||||
<div class="line"><a id="l00154" name="l00154"></a><span class="lineno"> 154</span> assert(<a class="code hl_function" href="../../d2/d45/segtree_8cpp.html#a423a97ea0c7ea6e33b5844a6858d902d">query</a>(&segtree, &lazy, 1, 5, 0, 7 - 1, 0) == 2 + 3 + 4 + 5 + 6);</div>
|
||||
<div class="line"><a id="l00155" name="l00155"></a><span class="lineno"> 155</span> </div>
|
||||
<div class="line"><a id="l00156" name="l00156"></a><span class="lineno"> 156</span> <a class="code hl_function" href="../../d2/d45/segtree_8cpp.html#abd3e818681fb2e29cf08f4f60f82c8e0">update</a>(&segtree, &lazy, 2, 4, 1, 0, 7 - 1, 0);</div>
|
||||
<div class="line"><a id="l00157" name="l00157"></a><span class="lineno"> 157</span> assert(<a class="code hl_function" href="../../d2/d45/segtree_8cpp.html#a423a97ea0c7ea6e33b5844a6858d902d">query</a>(&segtree, &lazy, 1, 5, 0, 7 - 1, 0) == 2 + 4 + 5 + 6 + 6);</div>
|
||||
<div class="line"><a id="l00158" name="l00158"></a><span class="lineno"> 158</span> </div>
|
||||
<div class="line"><a id="l00159" name="l00159"></a><span class="lineno"> 159</span> <a class="code hl_function" href="../../d2/d45/segtree_8cpp.html#abd3e818681fb2e29cf08f4f60f82c8e0">update</a>(&segtree, &lazy, 0, 6, -2, 0, 7 - 1, 0);</div>
|
||||
<div class="line"><a id="l00160" name="l00160"></a><span class="lineno"> 160</span> assert(<a class="code hl_function" href="../../d2/d45/segtree_8cpp.html#a423a97ea0c7ea6e33b5844a6858d902d">query</a>(&segtree, &lazy, 0, 4, 0, 7 - 1, 0) == -1 + 0 + 2 + 3 + 4);</div>
|
||||
<div class="line"><a id="l00161" name="l00161"></a><span class="lineno"> 161</span>}</div>
|
||||
</div>
|
||||
<div class="line"><a id="l00162" name="l00162"></a><span class="lineno"> 162</span> </div>
|
||||
<div class="foldopen" id="foldopen00168" data-start="{" data-end="}">
|
||||
<div class="line"><a id="l00168" name="l00168"></a><span class="lineno"><a class="line" href="../../d2/d45/segtree_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4"> 168</a></span><span class="keywordtype">int</span> <a class="code hl_function" href="../../d2/d45/segtree_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4">main</a>() {</div>
|
||||
<div class="line"><a id="l00169" name="l00169"></a><span class="lineno"> 169</span> <a class="code hl_function" href="../../d2/d45/segtree_8cpp.html#aa8dca7b867074164d5f45b0f3851269d">test</a>(); <span class="comment">// run self-test implementations</span></div>
|
||||
<div class="line"><a id="l00170" name="l00170"></a><span class="lineno"> 170</span> </div>
|
||||
<div class="line"><a id="l00171" name="l00171"></a><span class="lineno"> 171</span> std::cout << <span class="stringliteral">"Enter number of elements: "</span>;</div>
|
||||
<div class="line"><a id="l00172" name="l00172"></a><span class="lineno"> 172</span> </div>
|
||||
<div class="line"><a id="l00173" name="l00173"></a><span class="lineno"> 173</span> uint64_t n = 0;</div>
|
||||
<div class="line"><a id="l00174" name="l00174"></a><span class="lineno"> 174</span> std::cin >> n;</div>
|
||||
<div class="line"><a id="l00175" name="l00175"></a><span class="lineno"> 175</span> </div>
|
||||
<div class="line"><a id="l00176" name="l00176"></a><span class="lineno"> 176</span> <span class="keyword">auto</span> max = <span class="keyword">static_cast<</span>uint64_t<span class="keyword">></span>(2 * pow(2, ceil(log2(n))) - 1);</div>
|
||||
<div class="line"><a id="l00177" name="l00177"></a><span class="lineno"> 177</span> std::vector<int64_t> arr(n), lazy(max), segtree(max);</div>
|
||||
<div class="line"><a id="l00178" name="l00178"></a><span class="lineno"> 178</span> </div>
|
||||
<div class="line"><a id="l00179" name="l00179"></a><span class="lineno"> 179</span> <span class="keywordtype">int</span> choice = 0;</div>
|
||||
<div class="line"><a id="l00180" name="l00180"></a><span class="lineno"> 180</span> std::cout << <span class="stringliteral">"\nDo you wish to enter each number?:\n"</span></div>
|
||||
<div class="line"><a id="l00181" name="l00181"></a><span class="lineno"> 181</span> <span class="stringliteral">"1: Yes\n"</span></div>
|
||||
<div class="line"><a id="l00182" name="l00182"></a><span class="lineno"> 182</span> <span class="stringliteral">"0: No (default initialize them to 0)\n"</span>;</div>
|
||||
<div class="line"><a id="l00183" name="l00183"></a><span class="lineno"> 183</span> </div>
|
||||
<div class="line"><a id="l00184" name="l00184"></a><span class="lineno"> 184</span> std::cin >> choice;</div>
|
||||
<div class="line"><a id="l00185" name="l00185"></a><span class="lineno"> 185</span> <span class="keywordflow">if</span> (choice == 1) {</div>
|
||||
<div class="line"><a id="l00186" name="l00186"></a><span class="lineno"> 186</span> std::cout << <span class="stringliteral">"Enter "</span> << n << <span class="stringliteral">" numbers:\n"</span>;</div>
|
||||
<div class="line"><a id="l00187" name="l00187"></a><span class="lineno"> 187</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 1; i <= n; i++) {</div>
|
||||
<div class="line"><a id="l00188" name="l00188"></a><span class="lineno"> 188</span> std::cout << i << <span class="stringliteral">": "</span>;</div>
|
||||
<div class="line"><a id="l00189" name="l00189"></a><span class="lineno"> 189</span> std::cin >> arr[i];</div>
|
||||
<div class="line"><a id="l00190" name="l00190"></a><span class="lineno"> 190</span> }</div>
|
||||
<div class="line"><a id="l00191" name="l00191"></a><span class="lineno"> 191</span> }</div>
|
||||
<div class="line"><a id="l00192" name="l00192"></a><span class="lineno"> 192</span> </div>
|
||||
<div class="line"><a id="l00193" name="l00193"></a><span class="lineno"> 193</span> <a class="code hl_function" href="../../d2/d45/segtree_8cpp.html#ae752659b7c1719d68fdb2ca538a93696">ConsTree</a>(arr, &segtree, 0, n - 1, 0);</div>
|
||||
<div class="line"><a id="l00194" name="l00194"></a><span class="lineno"> 194</span> </div>
|
||||
<div class="line"><a id="l00195" name="l00195"></a><span class="lineno"> 195</span> <span class="keywordflow">do</span> {</div>
|
||||
<div class="line"><a id="l00196" name="l00196"></a><span class="lineno"> 196</span> std::cout << <span class="stringliteral">"\nMake your choice:\n"</span></div>
|
||||
<div class="line"><a id="l00197" name="l00197"></a><span class="lineno"> 197</span> <span class="stringliteral">"1: Range update (input)\n"</span></div>
|
||||
<div class="line"><a id="l00198" name="l00198"></a><span class="lineno"> 198</span> <span class="stringliteral">"2: Range query (output)\n"</span></div>
|
||||
<div class="line"><a id="l00199" name="l00199"></a><span class="lineno"> 199</span> <span class="stringliteral">"0: Exit\n"</span>;</div>
|
||||
<div class="line"><a id="l00200" name="l00200"></a><span class="lineno"> 200</span> std::cin >> choice;</div>
|
||||
<div class="line"><a id="l00201" name="l00201"></a><span class="lineno"> 201</span> </div>
|
||||
<div class="line"><a id="l00202" name="l00202"></a><span class="lineno"> 202</span> <span class="keywordflow">if</span> (choice == 1) {</div>
|
||||
<div class="line"><a id="l00203" name="l00203"></a><span class="lineno"> 203</span> std::cout << <span class="stringliteral">"Enter 1-indexed lower bound, upper bound & value:\n"</span>;</div>
|
||||
<div class="line"><a id="l00204" name="l00204"></a><span class="lineno"> 204</span> </div>
|
||||
<div class="line"><a id="l00205" name="l00205"></a><span class="lineno"> 205</span> uint64_t p = 1, q = 1, v = 0;</div>
|
||||
<div class="line"><a id="l00206" name="l00206"></a><span class="lineno"> 206</span> std::cin >> p >> q >> v;</div>
|
||||
<div class="line"><a id="l00207" name="l00207"></a><span class="lineno"> 207</span> <a class="code hl_function" href="../../d2/d45/segtree_8cpp.html#abd3e818681fb2e29cf08f4f60f82c8e0">update</a>(&segtree, &lazy, p - 1, q - 1, v, 0, n - 1, 0);</div>
|
||||
<div class="line"><a id="l00208" name="l00208"></a><span class="lineno"> 208</span> } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (choice == 2) {</div>
|
||||
<div class="line"><a id="l00209" name="l00209"></a><span class="lineno"> 209</span> std::cout << <span class="stringliteral">"Enter 1-indexed lower bound & upper bound:\n"</span>;</div>
|
||||
<div class="line"><a id="l00210" name="l00210"></a><span class="lineno"> 210</span> </div>
|
||||
<div class="line"><a id="l00211" name="l00211"></a><span class="lineno"> 211</span> uint64_t p = 1, q = 1;</div>
|
||||
<div class="line"><a id="l00212" name="l00212"></a><span class="lineno"> 212</span> std::cin >> p >> q;</div>
|
||||
<div class="line"><a id="l00213" name="l00213"></a><span class="lineno"> 213</span> std::cout << <a class="code hl_function" href="../../d2/d45/segtree_8cpp.html#a423a97ea0c7ea6e33b5844a6858d902d">query</a>(&segtree, &lazy, p - 1, q - 1, 0, n - 1, 0);</div>
|
||||
<div class="line"><a id="l00214" name="l00214"></a><span class="lineno"> 214</span> std::cout << <span class="stringliteral">"\n"</span>;</div>
|
||||
<div class="line"><a id="l00215" name="l00215"></a><span class="lineno"> 215</span> }</div>
|
||||
<div class="line"><a id="l00216" name="l00216"></a><span class="lineno"> 216</span> } <span class="keywordflow">while</span> (choice > 0);</div>
|
||||
<div class="line"><a id="l00217" name="l00217"></a><span class="lineno"> 217</span> </div>
|
||||
<div class="line"><a id="l00218" name="l00218"></a><span class="lineno"> 218</span> <span class="keywordflow">return</span> 0;</div>
|
||||
<div class="line"><a id="l00219" name="l00219"></a><span class="lineno"> 219</span>}</div>
|
||||
</div>
|
||||
<div class="ttc" id="asegtree_8cpp_html_a423a97ea0c7ea6e33b5844a6858d902d"><div class="ttname"><a href="../../d2/d45/segtree_8cpp.html#a423a97ea0c7ea6e33b5844a6858d902d">query</a></div><div class="ttdeci">int64_t query(std::vector< int64_t > *segtree, std::vector< int64_t > *lazy, uint64_t qlow, uint64_t qhigh, uint64_t low, uint64_t high, uint64_t pos)</div><div class="ttdoc">Returns the sum of all elements in a range.</div><div class="ttdef"><b>Definition</b> <a href="#l00063">segtree.cpp:63</a></div></div>
|
||||
<div class="ttc" id="asegtree_8cpp_html_aa8dca7b867074164d5f45b0f3851269d"><div class="ttname"><a href="../../d2/d45/segtree_8cpp.html#aa8dca7b867074164d5f45b0f3851269d">test</a></div><div class="ttdeci">static void test()</div><div class="ttdoc">Self-test implementation.</div><div class="ttdef"><b>Definition</b> <a href="#l00147">segtree.cpp:147</a></div></div>
|
||||
<div class="ttc" id="asegtree_8cpp_html_abd3e818681fb2e29cf08f4f60f82c8e0"><div class="ttname"><a href="../../d2/d45/segtree_8cpp.html#abd3e818681fb2e29cf08f4f60f82c8e0">update</a></div><div class="ttdeci">void update(std::vector< int64_t > *segtree, std::vector< int64_t > *lazy, int64_t start, int64_t end, int64_t delta, uint64_t low, uint64_t high, uint64_t pos)</div><div class="ttdoc">Updates a range of the segment tree.</div><div class="ttdef"><b>Definition</b> <a href="#l00103">segtree.cpp:103</a></div></div>
|
||||
<div class="ttc" id="asegtree_8cpp_html_ae66f6b31b5ad750f1fe042a706a4e3d4"><div class="ttname"><a href="../../d2/d45/segtree_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4">main</a></div><div class="ttdeci">int main()</div><div class="ttdoc">Main function.</div><div class="ttdef"><b>Definition</b> <a href="#l00168">segtree.cpp:168</a></div></div>
|
||||
<div class="ttc" id="asegtree_8cpp_html_ae752659b7c1719d68fdb2ca538a93696"><div class="ttname"><a href="../../d2/d45/segtree_8cpp.html#ae752659b7c1719d68fdb2ca538a93696">ConsTree</a></div><div class="ttdeci">void ConsTree(const std::vector< int64_t > &arr, std::vector< int64_t > *segtree, uint64_t low, uint64_t high, uint64_t pos)</div><div class="ttdoc">for std::vector</div><div class="ttdef"><b>Definition</b> <a href="#l00038">segtree.cpp:38</a></div></div>
|
||||
</div><!-- fragment --></div><!-- contents -->
|
||||
</div><!-- doc-content -->
|
||||
<!-- start footer part -->
|
||||
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
||||
<ul>
|
||||
<li class="navelem"><a class="el" href="../../dir_074119ce3a874b57120c49a0cc4bb5ad.html">range_queries</a></li><li class="navelem"><a class="el" href="../../d2/d45/segtree_8cpp.html">segtree.cpp</a></li>
|
||||
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="../../doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.12.0 </li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||