| 12345678910 |
- <svg xmlns="http://www.w3.org/2000/svg" width="950" height="330" viewBox="0 0 950 330">
- <style>.t{font:16px sans-serif;fill:#1f2937}.s{font:13px sans-serif;fill:#475569}.n{fill:#fff;stroke:#2563eb;stroke-width:3}.sent{fill:#e2e8f0;stroke:#475569;stroke-width:3}.mid{fill:#fef3c7;stroke:#d97706;stroke-width:4}.e{stroke:#64748b;stroke-width:3}.a{stroke:#16a34a;stroke-width:5;fill:none}</style>
- <rect width="950" height="330" fill="white"/><text x="32" y="34" class="t" font-weight="bold">双哨兵区间暴露:x=kth(l) 为根,y=kth(r+2) 为 x 的右儿子</text>
- <g class="e"><line x1="280" y1="105" x2="520" y2="175"/><line x1="520" y1="175" x2="405" y2="250"/><line x1="520" y1="175" x2="700" y2="250"/></g>
- <circle cx="280" cy="105" r="29" class="sent"/><circle cx="520" cy="175" r="29" class="sent"/><rect x="340" y="222" width="130" height="56" rx="9" class="mid"/><circle cx="700" cy="250" r="29" class="n"/>
- <g class="t" text-anchor="middle"><text x="280" y="111">x</text><text x="280" y="137" class="s">前驱/哨兵</text><text x="520" y="181">y</text><text x="520" y="207" class="s">后继/哨兵</text><text x="405" y="246">目标 [l,r]</text><text x="405" y="268" class="s">y.left</text><text x="700" y="256">其余后缀</text></g>
- <path d="M136 78 C175 50 222 52 255 77" class="a"/><path d="M255 77 l-14 -9 v18z" fill="#16a34a"/><text x="48" y="72" class="s">先 splay(x, root)</text>
- <path d="M620 88 C620 120 590 145 550 155" class="a"/><path d="M550 155 l10 -13 5 16z" fill="#16a34a"/><text x="625" y="80" class="s">再 splay(y, x)</text>
- <text x="145" y="316" class="s">翻转:对黄色子树 apply_rev;求和:直接读它的 sum。两端哨兵消除了 l=1、r=n 特判。</text>
- </svg>
|