181 lines
17 KiB
XML
181 lines
17 KiB
XML
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 900 580" width="900" height="580"><title>双指针统计差值为 C 的数对</title><defs><marker id="a" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0 0L10 5L0 10Z" fill="#416687"/></marker></defs><rect width="100%" height="100%" fill="white"/><g font-family="Microsoft YaHei,Arial,sans-serif" fill="#263c52" stroke-linecap="round">
|
||
<rect x="130" y="90" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="151.5" y="111.5" text-anchor="middle" dominant-baseline="central" font-size="18">0</text>
|
||
<rect x="173" y="90" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="194.5" y="111.5" text-anchor="middle" dominant-baseline="central" font-size="18">1</text>
|
||
<rect x="216" y="90" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="237.5" y="111.5" text-anchor="middle" dominant-baseline="central" font-size="18">2</text>
|
||
<rect x="259" y="90" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="280.5" y="111.5" text-anchor="middle" dominant-baseline="central" font-size="18">3</text>
|
||
<rect x="302" y="90" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="323.5" y="111.5" text-anchor="middle" dominant-baseline="central" font-size="18">4</text>
|
||
<rect x="345" y="90" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="366.5" y="111.5" text-anchor="middle" dominant-baseline="central" font-size="18">5</text>
|
||
<rect x="388" y="90" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="409.5" y="111.5" text-anchor="middle" dominant-baseline="central" font-size="18">6</text>
|
||
<rect x="431" y="90" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="452.5" y="111.5" text-anchor="middle" dominant-baseline="central" font-size="18">7</text>
|
||
<rect x="130" y="133" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="151.5" y="154.5" text-anchor="middle" dominant-baseline="central" font-size="18">2</text>
|
||
<rect x="173" y="133" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="194.5" y="154.5" text-anchor="middle" dominant-baseline="central" font-size="18">2</text>
|
||
<rect x="216" y="133" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="237.5" y="154.5" text-anchor="middle" dominant-baseline="central" font-size="18">3</text>
|
||
<rect x="259" y="133" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="280.5" y="154.5" text-anchor="middle" dominant-baseline="central" font-size="18">4</text>
|
||
<rect x="302" y="133" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="323.5" y="154.5" text-anchor="middle" dominant-baseline="central" font-size="18">5</text>
|
||
<rect x="345" y="133" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="366.5" y="154.5" text-anchor="middle" dominant-baseline="central" font-size="18">5</text>
|
||
<rect x="388" y="133" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="409.5" y="154.5" text-anchor="middle" dominant-baseline="central" font-size="18">7</text>
|
||
<rect x="431" y="133" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="452.5" y="154.5" text-anchor="middle" dominant-baseline="central" font-size="18">8</text>
|
||
<rect x="130" y="176" width="43" height="43" stroke="#67859e" fill="#c7d6e6" stroke-width="1.5"/>
|
||
<text x="151.5" y="197.5" text-anchor="middle" dominant-baseline="central" font-size="18">2</text>
|
||
<rect x="173" y="176" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="194.5" y="197.5" text-anchor="middle" dominant-baseline="central" font-size="18">2</text>
|
||
<rect x="216" y="176" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="237.5" y="197.5" text-anchor="middle" dominant-baseline="central" font-size="18">3</text>
|
||
<rect x="259" y="176" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="280.5" y="197.5" text-anchor="middle" dominant-baseline="central" font-size="18">4</text>
|
||
<rect x="302" y="176" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="323.5" y="197.5" text-anchor="middle" dominant-baseline="central" font-size="18">5</text>
|
||
<rect x="345" y="176" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="366.5" y="197.5" text-anchor="middle" dominant-baseline="central" font-size="18">5</text>
|
||
<rect x="388" y="176" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="409.5" y="197.5" text-anchor="middle" dominant-baseline="central" font-size="18">7</text>
|
||
<rect x="431" y="176" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="452.5" y="197.5" text-anchor="middle" dominant-baseline="central" font-size="18">8</text>
|
||
<rect x="130" y="219" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="151.5" y="240.5" text-anchor="middle" dominant-baseline="central" font-size="18">2</text>
|
||
<rect x="173" y="219" width="43" height="43" stroke="#67859e" fill="#c7d6e6" stroke-width="1.5"/>
|
||
<text x="194.5" y="240.5" text-anchor="middle" dominant-baseline="central" font-size="18">2</text>
|
||
<rect x="216" y="219" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="237.5" y="240.5" text-anchor="middle" dominant-baseline="central" font-size="18">3</text>
|
||
<rect x="259" y="219" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="280.5" y="240.5" text-anchor="middle" dominant-baseline="central" font-size="18">4</text>
|
||
<rect x="302" y="219" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="323.5" y="240.5" text-anchor="middle" dominant-baseline="central" font-size="18">5</text>
|
||
<rect x="345" y="219" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="366.5" y="240.5" text-anchor="middle" dominant-baseline="central" font-size="18">5</text>
|
||
<rect x="388" y="219" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="409.5" y="240.5" text-anchor="middle" dominant-baseline="central" font-size="18">7</text>
|
||
<rect x="431" y="219" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="452.5" y="240.5" text-anchor="middle" dominant-baseline="central" font-size="18">8</text>
|
||
<rect x="130" y="262" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="151.5" y="283.5" text-anchor="middle" dominant-baseline="central" font-size="18">2</text>
|
||
<rect x="173" y="262" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="194.5" y="283.5" text-anchor="middle" dominant-baseline="central" font-size="18">2</text>
|
||
<rect x="216" y="262" width="43" height="43" stroke="#67859e" fill="#c7d6e6" stroke-width="1.5"/>
|
||
<text x="237.5" y="283.5" text-anchor="middle" dominant-baseline="central" font-size="18">3</text>
|
||
<rect x="259" y="262" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="280.5" y="283.5" text-anchor="middle" dominant-baseline="central" font-size="18">4</text>
|
||
<rect x="302" y="262" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="323.5" y="283.5" text-anchor="middle" dominant-baseline="central" font-size="18">5</text>
|
||
<rect x="345" y="262" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="366.5" y="283.5" text-anchor="middle" dominant-baseline="central" font-size="18">5</text>
|
||
<rect x="388" y="262" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="409.5" y="283.5" text-anchor="middle" dominant-baseline="central" font-size="18">7</text>
|
||
<rect x="431" y="262" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="452.5" y="283.5" text-anchor="middle" dominant-baseline="central" font-size="18">8</text>
|
||
<rect x="130" y="305" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="151.5" y="326.5" text-anchor="middle" dominant-baseline="central" font-size="18">2</text>
|
||
<rect x="173" y="305" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="194.5" y="326.5" text-anchor="middle" dominant-baseline="central" font-size="18">2</text>
|
||
<rect x="216" y="305" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="237.5" y="326.5" text-anchor="middle" dominant-baseline="central" font-size="18">3</text>
|
||
<rect x="259" y="305" width="43" height="43" stroke="#67859e" fill="#c7d6e6" stroke-width="1.5"/>
|
||
<text x="280.5" y="326.5" text-anchor="middle" dominant-baseline="central" font-size="18">4</text>
|
||
<rect x="302" y="305" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="323.5" y="326.5" text-anchor="middle" dominant-baseline="central" font-size="18">5</text>
|
||
<rect x="345" y="305" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="366.5" y="326.5" text-anchor="middle" dominant-baseline="central" font-size="18">5</text>
|
||
<rect x="388" y="305" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="409.5" y="326.5" text-anchor="middle" dominant-baseline="central" font-size="18">7</text>
|
||
<rect x="431" y="305" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="452.5" y="326.5" text-anchor="middle" dominant-baseline="central" font-size="18">8</text>
|
||
<rect x="130" y="348" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="151.5" y="369.5" text-anchor="middle" dominant-baseline="central" font-size="18">2</text>
|
||
<rect x="173" y="348" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="194.5" y="369.5" text-anchor="middle" dominant-baseline="central" font-size="18">2</text>
|
||
<rect x="216" y="348" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="237.5" y="369.5" text-anchor="middle" dominant-baseline="central" font-size="18">3</text>
|
||
<rect x="259" y="348" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="280.5" y="369.5" text-anchor="middle" dominant-baseline="central" font-size="18">4</text>
|
||
<rect x="302" y="348" width="43" height="43" stroke="#67859e" fill="#c7d6e6" stroke-width="1.5"/>
|
||
<text x="323.5" y="369.5" text-anchor="middle" dominant-baseline="central" font-size="18">5</text>
|
||
<rect x="345" y="348" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="366.5" y="369.5" text-anchor="middle" dominant-baseline="central" font-size="18">5</text>
|
||
<rect x="388" y="348" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="409.5" y="369.5" text-anchor="middle" dominant-baseline="central" font-size="18">7</text>
|
||
<rect x="431" y="348" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="452.5" y="369.5" text-anchor="middle" dominant-baseline="central" font-size="18">8</text>
|
||
<rect x="130" y="391" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="151.5" y="412.5" text-anchor="middle" dominant-baseline="central" font-size="18">2</text>
|
||
<rect x="173" y="391" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="194.5" y="412.5" text-anchor="middle" dominant-baseline="central" font-size="18">2</text>
|
||
<rect x="216" y="391" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="237.5" y="412.5" text-anchor="middle" dominant-baseline="central" font-size="18">3</text>
|
||
<rect x="259" y="391" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="280.5" y="412.5" text-anchor="middle" dominant-baseline="central" font-size="18">4</text>
|
||
<rect x="302" y="391" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="323.5" y="412.5" text-anchor="middle" dominant-baseline="central" font-size="18">5</text>
|
||
<rect x="345" y="391" width="43" height="43" stroke="#67859e" fill="#c7d6e6" stroke-width="1.5"/>
|
||
<text x="366.5" y="412.5" text-anchor="middle" dominant-baseline="central" font-size="18">5</text>
|
||
<rect x="388" y="391" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="409.5" y="412.5" text-anchor="middle" dominant-baseline="central" font-size="18">7</text>
|
||
<rect x="431" y="391" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="452.5" y="412.5" text-anchor="middle" dominant-baseline="central" font-size="18">8</text>
|
||
<rect x="130" y="434" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="151.5" y="455.5" text-anchor="middle" dominant-baseline="central" font-size="18">2</text>
|
||
<rect x="173" y="434" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="194.5" y="455.5" text-anchor="middle" dominant-baseline="central" font-size="18">2</text>
|
||
<rect x="216" y="434" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="237.5" y="455.5" text-anchor="middle" dominant-baseline="central" font-size="18">3</text>
|
||
<rect x="259" y="434" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="280.5" y="455.5" text-anchor="middle" dominant-baseline="central" font-size="18">4</text>
|
||
<rect x="302" y="434" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="323.5" y="455.5" text-anchor="middle" dominant-baseline="central" font-size="18">5</text>
|
||
<rect x="345" y="434" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="366.5" y="455.5" text-anchor="middle" dominant-baseline="central" font-size="18">5</text>
|
||
<rect x="388" y="434" width="43" height="43" stroke="#67859e" fill="#c7d6e6" stroke-width="1.5"/>
|
||
<text x="409.5" y="455.5" text-anchor="middle" dominant-baseline="central" font-size="18">7</text>
|
||
<rect x="431" y="434" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="452.5" y="455.5" text-anchor="middle" dominant-baseline="central" font-size="18">8</text>
|
||
<rect x="130" y="477" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="151.5" y="498.5" text-anchor="middle" dominant-baseline="central" font-size="18">2</text>
|
||
<rect x="173" y="477" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="194.5" y="498.5" text-anchor="middle" dominant-baseline="central" font-size="18">2</text>
|
||
<rect x="216" y="477" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="237.5" y="498.5" text-anchor="middle" dominant-baseline="central" font-size="18">3</text>
|
||
<rect x="259" y="477" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="280.5" y="498.5" text-anchor="middle" dominant-baseline="central" font-size="18">4</text>
|
||
<rect x="302" y="477" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="323.5" y="498.5" text-anchor="middle" dominant-baseline="central" font-size="18">5</text>
|
||
<rect x="345" y="477" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="366.5" y="498.5" text-anchor="middle" dominant-baseline="central" font-size="18">5</text>
|
||
<rect x="388" y="477" width="43" height="43" stroke="#67859e" fill="white" stroke-width="1.5"/>
|
||
<text x="409.5" y="498.5" text-anchor="middle" dominant-baseline="central" font-size="18">7</text>
|
||
<rect x="431" y="477" width="43" height="43" stroke="#67859e" fill="#c7d6e6" stroke-width="1.5"/>
|
||
<text x="452.5" y="498.5" text-anchor="middle" dominant-baseline="central" font-size="18">8</text>
|
||
<text x="15" y="25" font-size="18">每次增加 l 和 r,使 s[l] 为首个 ≥ s[i] − C 的数,s[r] 为首个 > s[i] − C 的数。</text>
|
||
<text x="15" y="118" font-size="16">i</text>
|
||
<text x="15" y="161" font-size="16">排序后的 s[i]</text>
|
||
<text x="15" y="204" font-size="16">处理 s[0]</text>
|
||
<text x="15" y="247" font-size="16">处理 s[1]</text>
|
||
<text x="15" y="290" font-size="16">处理 s[2]</text>
|
||
<text x="15" y="333" font-size="16">处理 s[3]</text>
|
||
<text x="15" y="376" font-size="16">处理 s[4]</text>
|
||
<text x="15" y="419" font-size="16">处理 s[5]</text>
|
||
<text x="15" y="462" font-size="16">处理 s[6]</text>
|
||
<text x="15" y="505" font-size="16">处理 s[7]</text>
|
||
<text x="490" y="204" font-size="18">l = r = 0</text>
|
||
<text x="490" y="247" font-size="18">l = r = 0</text>
|
||
<text x="490" y="290" font-size="18">l = r = 0</text>
|
||
<text x="490" y="333" font-size="18">l = r = 0</text>
|
||
<text x="490" y="376" font-size="18">l = 0,r = 2;答案增加 r − l = 2</text>
|
||
<text x="490" y="419" font-size="18">l = 0,r = 2;答案增加 r − l = 2</text>
|
||
<text x="490" y="462" font-size="18">l = 3,r = 4;答案增加 r − l = 1</text>
|
||
<text x="490" y="505" font-size="18">l = 4,r = 6;答案增加 r − l = 2</text>
|
||
</g></svg> |