﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-算法学习</title><link>http://www.cppblog.com/Darren/</link><description>C++ 及算法</description><language>zh-cn</language><lastBuildDate>Tue, 07 Apr 2026 21:35:26 GMT</lastBuildDate><pubDate>Tue, 07 Apr 2026 21:35:26 GMT</pubDate><ttl>60</ttl><item><title>换个博客，重新开始学习。。。</title><link>http://www.cppblog.com/Darren/archive/2010/04/30/114008.html</link><dc:creator>Darren</dc:creator><author>Darren</author><pubDate>Thu, 29 Apr 2010 16:52:00 GMT</pubDate><guid>http://www.cppblog.com/Darren/archive/2010/04/30/114008.html</guid><wfw:comment>http://www.cppblog.com/Darren/comments/114008.html</wfw:comment><comments>http://www.cppblog.com/Darren/archive/2010/04/30/114008.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Darren/comments/commentRss/114008.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Darren/services/trackbacks/114008.html</trackback:ping><description><![CDATA[新博客地址: <a  href="http://dnizna.javaeye.com/">http://dnizna.javaeye.com/</a><br><img src ="http://www.cppblog.com/Darren/aggbug/114008.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Darren/" target="_blank">Darren</a> 2010-04-30 00:52 <a href="http://www.cppblog.com/Darren/archive/2010/04/30/114008.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>pku  1691  Painting A Board  状态压缩DP</title><link>http://www.cppblog.com/Darren/archive/2009/10/08/98083.html</link><dc:creator>Darren</dc:creator><author>Darren</author><pubDate>Thu, 08 Oct 2009 06:54:00 GMT</pubDate><guid>http://www.cppblog.com/Darren/archive/2009/10/08/98083.html</guid><wfw:comment>http://www.cppblog.com/Darren/comments/98083.html</wfw:comment><comments>http://www.cppblog.com/Darren/archive/2009/10/08/98083.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Darren/comments/commentRss/98083.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Darren/services/trackbacks/98083.html</trackback:ping><description><![CDATA[
		<p> </p>
		<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
				<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				<span style="COLOR: #000000">#include </span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #000000">stdio.h</span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />#include </span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #000000">stdlib.h</span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />#include </span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #0000ff">string</span>
				<span style="COLOR: #000000">.h</span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				</span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #0000ff">const</span>
				<span style="COLOR: #000000"> inf</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">1</span>
				<span style="COLOR: #000000">&lt;&lt;</span>
				<span style="COLOR: #000000">29</span>
				<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> n;<br /><img id="Codehighlighter1_101_127_Open_Image" onclick="this.style.display='none'; Codehighlighter1_101_127_Open_Text.style.display='none'; Codehighlighter1_101_127_Closed_Image.style.display='inline'; Codehighlighter1_101_127_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_101_127_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_101_127_Closed_Text.style.display='none'; Codehighlighter1_101_127_Open_Image.style.display='inline'; Codehighlighter1_101_127_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span style="COLOR: #0000ff">struct</span>
				<span style="COLOR: #000000"> Point</span>
				<span id="Codehighlighter1_101_127_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
						<img src="http://www.cppblog.com/images/dot.gif" />
				</span>
				<span id="Codehighlighter1_101_127_Open_Text">
						<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> Lx, Ly, Rx, Ry;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
				<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />Point pnt[</span>
				<span style="COLOR: #000000">16</span>
				<span style="COLOR: #000000">];<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000">  need[</span>
				<span style="COLOR: #000000">16</span>
				<span style="COLOR: #000000">], dp[</span>
				<span style="COLOR: #000000">1</span>
				<span style="COLOR: #000000">&lt;&lt;</span>
				<span style="COLOR: #000000">15</span>
				<span style="COLOR: #000000">][</span>
				<span style="COLOR: #000000">15</span>
				<span style="COLOR: #000000">], color[</span>
				<span style="COLOR: #000000">16</span>
				<span style="COLOR: #000000">];<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /><br /><img id="Codehighlighter1_199_481_Open_Image" onclick="this.style.display='none'; Codehighlighter1_199_481_Open_Text.style.display='none'; Codehighlighter1_199_481_Closed_Image.style.display='inline'; Codehighlighter1_199_481_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_199_481_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_199_481_Closed_Text.style.display='none'; Codehighlighter1_199_481_Open_Image.style.display='inline'; Codehighlighter1_199_481_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span style="COLOR: #0000ff">void</span>
				<span style="COLOR: #000000"> init()</span>
				<span id="Codehighlighter1_199_481_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
						<img src="http://www.cppblog.com/images/dot.gif" />
				</span>
				<span id="Codehighlighter1_199_481_Open_Text">
						<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">for</span>
						<span style="COLOR: #000000">( </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> i</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000">; i</span>
						<span style="COLOR: #000000">&lt;=</span>
						<span style="COLOR: #000000"> n; </span>
						<span style="COLOR: #000000">++</span>
						<span style="COLOR: #000000">i ) need[i]</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    <br /><img id="Codehighlighter1_280_479_Open_Image" onclick="this.style.display='none'; Codehighlighter1_280_479_Open_Text.style.display='none'; Codehighlighter1_280_479_Closed_Image.style.display='inline'; Codehighlighter1_280_479_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_280_479_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_280_479_Closed_Text.style.display='none'; Codehighlighter1_280_479_Open_Image.style.display='inline'; Codehighlighter1_280_479_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">for</span>
						<span style="COLOR: #000000">( </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> i</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000">; i</span>
						<span style="COLOR: #000000">&lt;</span>
						<span style="COLOR: #000000"> n; </span>
						<span style="COLOR: #000000">++</span>
						<span style="COLOR: #000000">i )</span>
						<span id="Codehighlighter1_280_479_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
								<img src="http://www.cppblog.com/images/dot.gif" />
						</span>
						<span id="Codehighlighter1_280_479_Open_Text">
								<span style="COLOR: #000000">{<br /><img id="Codehighlighter1_315_473_Open_Image" onclick="this.style.display='none'; Codehighlighter1_315_473_Open_Text.style.display='none'; Codehighlighter1_315_473_Closed_Image.style.display='inline'; Codehighlighter1_315_473_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_315_473_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_315_473_Closed_Text.style.display='none'; Codehighlighter1_315_473_Open_Image.style.display='inline'; Codehighlighter1_315_473_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">for</span>
								<span style="COLOR: #000000">(</span>
								<span style="COLOR: #0000ff">int</span>
								<span style="COLOR: #000000"> j</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">0</span>
								<span style="COLOR: #000000">; j</span>
								<span style="COLOR: #000000">&lt;</span>
								<span style="COLOR: #000000"> n; </span>
								<span style="COLOR: #000000">++</span>
								<span style="COLOR: #000000">j )</span>
								<span id="Codehighlighter1_315_473_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
										<img src="http://www.cppblog.com/images/dot.gif" />
								</span>
								<span id="Codehighlighter1_315_473_Open_Text">
										<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
										<span style="COLOR: #0000ff">if</span>
										<span style="COLOR: #000000">( i</span>
										<span style="COLOR: #000000">==</span>
										<span style="COLOR: #000000"> j ) </span>
										<span style="COLOR: #0000ff">continue</span>
										<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img id="Codehighlighter1_415_463_Open_Image" onclick="this.style.display='none'; Codehighlighter1_415_463_Open_Text.style.display='none'; Codehighlighter1_415_463_Closed_Image.style.display='inline'; Codehighlighter1_415_463_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_415_463_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_415_463_Closed_Text.style.display='none'; Codehighlighter1_415_463_Open_Image.style.display='inline'; Codehighlighter1_415_463_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />            </span>
										<span style="COLOR: #0000ff">if</span>
										<span style="COLOR: #000000">( pnt[j].Ry</span>
										<span style="COLOR: #000000">&lt;=</span>
										<span style="COLOR: #000000"> pnt[i].Ly </span>
										<span style="COLOR: #000000">&amp;&amp;</span>
										<span style="COLOR: #000000"> pnt[j].Lx</span>
										<span style="COLOR: #000000">&lt;</span>
										<span style="COLOR: #000000"> pnt[i].Rx )</span>
										<span id="Codehighlighter1_415_463_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
												<img src="http://www.cppblog.com/images/dot.gif" />
										</span>
										<span id="Codehighlighter1_415_463_Open_Text">
												<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                need[i]</span>
												<span style="COLOR: #000000">|=</span>
												<span style="COLOR: #000000"> (</span>
												<span style="COLOR: #000000">1</span>
												<span style="COLOR: #000000">&lt;&lt;</span>
												<span style="COLOR: #000000">j);<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />            }</span>
										</span>
										<span style="COLOR: #000000">
												<br />
												<img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />        }</span>
								</span>
								<span style="COLOR: #000000">
										<br />
										<img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</span>
						</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
						<br />
						<img id="Codehighlighter1_496_1266_Open_Image" onclick="this.style.display='none'; Codehighlighter1_496_1266_Open_Text.style.display='none'; Codehighlighter1_496_1266_Closed_Image.style.display='inline'; Codehighlighter1_496_1266_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" />
						<img id="Codehighlighter1_496_1266_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_496_1266_Closed_Text.style.display='none'; Codehighlighter1_496_1266_Open_Image.style.display='inline'; Codehighlighter1_496_1266_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" />
				</span>
				<span style="COLOR: #0000ff">void</span>
				<span style="COLOR: #000000"> solve()</span>
				<span id="Codehighlighter1_496_1266_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
						<img src="http://www.cppblog.com/images/dot.gif" />
				</span>
				<span id="Codehighlighter1_496_1266_Open_Text">
						<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">for</span>
						<span style="COLOR: #000000">( </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> i</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000">; i</span>
						<span style="COLOR: #000000">&lt;</span>
						<span style="COLOR: #000000"> (</span>
						<span style="COLOR: #000000">1</span>
						<span style="COLOR: #000000">&lt;&lt;</span>
						<span style="COLOR: #000000">n); </span>
						<span style="COLOR: #000000">++</span>
						<span style="COLOR: #000000">i )<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
						<span style="COLOR: #0000ff">for</span>
						<span style="COLOR: #000000">(</span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> j</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000">; j</span>
						<span style="COLOR: #000000">&lt;</span>
						<span style="COLOR: #000000"> n; </span>
						<span style="COLOR: #000000">++</span>
						<span style="COLOR: #000000">j ) dp[i][j]</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> inf;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    dp[</span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000">][</span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000">]</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">for</span>
						<span style="COLOR: #000000">( </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> i</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000">; i</span>
						<span style="COLOR: #000000">&lt;</span>
						<span style="COLOR: #000000"> n; </span>
						<span style="COLOR: #000000">++</span>
						<span style="COLOR: #000000">i )<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
						<span style="COLOR: #0000ff">if</span>
						<span style="COLOR: #000000">( need[i]</span>
						<span style="COLOR: #000000">==</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000"> ) dp[</span>
						<span style="COLOR: #000000">1</span>
						<span style="COLOR: #000000">&lt;&lt;</span>
						<span style="COLOR: #000000">i][i]</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">1</span>
						<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    <br /><img id="Codehighlighter1_714_1129_Open_Image" onclick="this.style.display='none'; Codehighlighter1_714_1129_Open_Text.style.display='none'; Codehighlighter1_714_1129_Closed_Image.style.display='inline'; Codehighlighter1_714_1129_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_714_1129_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_714_1129_Closed_Text.style.display='none'; Codehighlighter1_714_1129_Open_Image.style.display='inline'; Codehighlighter1_714_1129_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">for</span>
						<span style="COLOR: #000000">( </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> s</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000">; s</span>
						<span style="COLOR: #000000">&lt;</span>
						<span style="COLOR: #000000"> (</span>
						<span style="COLOR: #000000">1</span>
						<span style="COLOR: #000000">&lt;&lt;</span>
						<span style="COLOR: #000000">n); </span>
						<span style="COLOR: #000000">++</span>
						<span style="COLOR: #000000">s )</span>
						<span id="Codehighlighter1_714_1129_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
								<img src="http://www.cppblog.com/images/dot.gif" />
						</span>
						<span id="Codehighlighter1_714_1129_Open_Text">
								<span style="COLOR: #000000">{<br /><img id="Codehighlighter1_750_1123_Open_Image" onclick="this.style.display='none'; Codehighlighter1_750_1123_Open_Text.style.display='none'; Codehighlighter1_750_1123_Closed_Image.style.display='inline'; Codehighlighter1_750_1123_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_750_1123_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_750_1123_Closed_Text.style.display='none'; Codehighlighter1_750_1123_Open_Image.style.display='inline'; Codehighlighter1_750_1123_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">for</span>
								<span style="COLOR: #000000">( </span>
								<span style="COLOR: #0000ff">int</span>
								<span style="COLOR: #000000"> i</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">0</span>
								<span style="COLOR: #000000">; i</span>
								<span style="COLOR: #000000">&lt;</span>
								<span style="COLOR: #000000"> n; </span>
								<span style="COLOR: #000000">++</span>
								<span style="COLOR: #000000">i )</span>
								<span id="Codehighlighter1_750_1123_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
										<img src="http://www.cppblog.com/images/dot.gif" />
								</span>
								<span id="Codehighlighter1_750_1123_Open_Text">
										<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
										<span style="COLOR: #0000ff">if</span>
										<span style="COLOR: #000000">( ( s</span>
										<span style="COLOR: #000000">&amp;</span>
										<span style="COLOR: #000000"> (</span>
										<span style="COLOR: #000000">1</span>
										<span style="COLOR: #000000">&lt;&lt;</span>
										<span style="COLOR: #000000">i) )</span>
										<span style="COLOR: #000000">==</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #000000">0</span>
										<span style="COLOR: #000000"> ) </span>
										<span style="COLOR: #0000ff">continue</span>
										<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img id="Codehighlighter1_837_1113_Open_Image" onclick="this.style.display='none'; Codehighlighter1_837_1113_Open_Text.style.display='none'; Codehighlighter1_837_1113_Closed_Image.style.display='inline'; Codehighlighter1_837_1113_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_837_1113_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_837_1113_Closed_Text.style.display='none'; Codehighlighter1_837_1113_Open_Image.style.display='inline'; Codehighlighter1_837_1113_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />            </span>
										<span style="COLOR: #0000ff">for</span>
										<span style="COLOR: #000000">( </span>
										<span style="COLOR: #0000ff">int</span>
										<span style="COLOR: #000000"> j</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #000000">0</span>
										<span style="COLOR: #000000">; j</span>
										<span style="COLOR: #000000">&lt;</span>
										<span style="COLOR: #000000"> n; </span>
										<span style="COLOR: #000000">++</span>
										<span style="COLOR: #000000">j )</span>
										<span id="Codehighlighter1_837_1113_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
												<img src="http://www.cppblog.com/images/dot.gif" />
										</span>
										<span id="Codehighlighter1_837_1113_Open_Text">
												<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                </span>
												<span style="COLOR: #0000ff">if</span>
												<span style="COLOR: #000000">( s</span>
												<span style="COLOR: #000000">&amp;</span>
												<span style="COLOR: #000000"> (</span>
												<span style="COLOR: #000000">1</span>
												<span style="COLOR: #000000">&lt;&lt;</span>
												<span style="COLOR: #000000">j) ) </span>
												<span style="COLOR: #0000ff">continue</span>
												<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                </span>
												<span style="COLOR: #0000ff">if</span>
												<span style="COLOR: #000000">( (s</span>
												<span style="COLOR: #000000">&amp;</span>
												<span style="COLOR: #000000"> need[j])</span>
												<span style="COLOR: #000000">!=</span>
												<span style="COLOR: #000000"> need[j] ) </span>
												<span style="COLOR: #0000ff">continue</span>
												<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img id="Codehighlighter1_1009_1099_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1009_1099_Open_Text.style.display='none'; Codehighlighter1_1009_1099_Closed_Image.style.display='inline'; Codehighlighter1_1009_1099_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_1009_1099_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1009_1099_Closed_Text.style.display='none'; Codehighlighter1_1009_1099_Open_Image.style.display='inline'; Codehighlighter1_1009_1099_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />                </span>
												<span style="COLOR: #0000ff">if</span>
												<span style="COLOR: #000000">( dp[s][i]</span>
												<span style="COLOR: #000000">+</span>
												<span style="COLOR: #000000"> ( color[i]</span>
												<span style="COLOR: #000000">!=</span>
												<span style="COLOR: #000000"> color[j] )</span>
												<span style="COLOR: #000000">&lt;</span>
												<span style="COLOR: #000000"> dp[s</span>
												<span style="COLOR: #000000">|</span>
												<span style="COLOR: #000000">(</span>
												<span style="COLOR: #000000">1</span>
												<span style="COLOR: #000000">&lt;&lt;</span>
												<span style="COLOR: #000000">j)][j] )</span>
												<span id="Codehighlighter1_1009_1099_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
														<img src="http://www.cppblog.com/images/dot.gif" />
												</span>
												<span id="Codehighlighter1_1009_1099_Open_Text">
														<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                    dp[s</span>
														<span style="COLOR: #000000">|</span>
														<span style="COLOR: #000000">(</span>
														<span style="COLOR: #000000">1</span>
														<span style="COLOR: #000000">&lt;&lt;</span>
														<span style="COLOR: #000000">j)][j]</span>
														<span style="COLOR: #000000">=</span>
														<span style="COLOR: #000000"> dp[s][i]</span>
														<span style="COLOR: #000000">+</span>
														<span style="COLOR: #000000"> ( color[i]</span>
														<span style="COLOR: #000000">!=</span>
														<span style="COLOR: #000000"> color[j] );<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />                }</span>
												</span>
												<span style="COLOR: #000000">
														<br />
														<img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />            }</span>
										</span>
										<span style="COLOR: #000000">
												<br />
												<img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />        }</span>
								</span>
								<span style="COLOR: #000000">
										<br />
										<img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</span>
						</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />
								<br />
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> ans</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> inf;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">for</span>
						<span style="COLOR: #000000">( </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> i</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000">; i</span>
						<span style="COLOR: #000000">&lt;</span>
						<span style="COLOR: #000000"> n; </span>
						<span style="COLOR: #000000">++</span>
						<span style="COLOR: #000000">i )<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
						<span style="COLOR: #0000ff">if</span>
						<span style="COLOR: #000000">( dp[(</span>
						<span style="COLOR: #000000">1</span>
						<span style="COLOR: #000000">&lt;&lt;</span>
						<span style="COLOR: #000000">n)</span>
						<span style="COLOR: #000000">-</span>
						<span style="COLOR: #000000">1</span>
						<span style="COLOR: #000000">][i]</span>
						<span style="COLOR: #000000">&lt;</span>
						<span style="COLOR: #000000"> ans ) ans</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> dp[(</span>
						<span style="COLOR: #000000">1</span>
						<span style="COLOR: #000000">&lt;&lt;</span>
						<span style="COLOR: #000000">n)</span>
						<span style="COLOR: #000000">-</span>
						<span style="COLOR: #000000">1</span>
						<span style="COLOR: #000000">][i];<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    printf(</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">%d\n</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">, ans );<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
						<br />
						<img id="Codehighlighter1_1279_1589_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1279_1589_Open_Text.style.display='none'; Codehighlighter1_1279_1589_Closed_Image.style.display='inline'; Codehighlighter1_1279_1589_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" />
						<img id="Codehighlighter1_1279_1589_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1279_1589_Closed_Text.style.display='none'; Codehighlighter1_1279_1589_Open_Image.style.display='inline'; Codehighlighter1_1279_1589_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" />
				</span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> main()</span>
				<span id="Codehighlighter1_1279_1589_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
						<img src="http://www.cppblog.com/images/dot.gif" />
				</span>
				<span id="Codehighlighter1_1279_1589_Open_Text">
						<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> test;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    scanf(</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">%d</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">,</span>
						<span style="COLOR: #000000">&amp;</span>
						<span style="COLOR: #000000">test );<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img id="Codehighlighter1_1339_1568_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1339_1568_Open_Text.style.display='none'; Codehighlighter1_1339_1568_Closed_Image.style.display='inline'; Codehighlighter1_1339_1568_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_1339_1568_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1339_1568_Closed_Text.style.display='none'; Codehighlighter1_1339_1568_Open_Image.style.display='inline'; Codehighlighter1_1339_1568_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">while</span>
						<span style="COLOR: #000000">( test</span>
						<span style="COLOR: #000000">--</span>
						<span style="COLOR: #000000"> )</span>
						<span id="Codehighlighter1_1339_1568_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
								<img src="http://www.cppblog.com/images/dot.gif" />
						</span>
						<span id="Codehighlighter1_1339_1568_Open_Text">
								<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        scanf(</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">%d</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">,</span>
								<span style="COLOR: #000000">&amp;</span>
								<span style="COLOR: #000000">n );<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img id="Codehighlighter1_1401_1528_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1401_1528_Open_Text.style.display='none'; Codehighlighter1_1401_1528_Closed_Image.style.display='inline'; Codehighlighter1_1401_1528_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_1401_1528_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1401_1528_Closed_Text.style.display='none'; Codehighlighter1_1401_1528_Open_Image.style.display='inline'; Codehighlighter1_1401_1528_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">for</span>
								<span style="COLOR: #000000">( </span>
								<span style="COLOR: #0000ff">int</span>
								<span style="COLOR: #000000"> i</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">0</span>
								<span style="COLOR: #000000">; i</span>
								<span style="COLOR: #000000">&lt;</span>
								<span style="COLOR: #000000"> n; </span>
								<span style="COLOR: #000000">++</span>
								<span style="COLOR: #000000">i )</span>
								<span id="Codehighlighter1_1401_1528_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
										<img src="http://www.cppblog.com/images/dot.gif" />
								</span>
								<span id="Codehighlighter1_1401_1528_Open_Text">
										<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            scanf(</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">%d%d%d%d</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">, </span>
										<span style="COLOR: #000000">&amp;</span>
										<span style="COLOR: #000000">pnt[i].Ly, </span>
										<span style="COLOR: #000000">&amp;</span>
										<span style="COLOR: #000000">pnt[i].Lx, </span>
										<span style="COLOR: #000000">&amp;</span>
										<span style="COLOR: #000000">pnt[i].Ry,  </span>
										<span style="COLOR: #000000">&amp;</span>
										<span style="COLOR: #000000">pnt[i].Rx );<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            scanf(</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">%d</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">, color</span>
										<span style="COLOR: #000000">+</span>
										<span style="COLOR: #000000"> i );<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />        }</span>
								</span>
								<span style="COLOR: #000000">
										<br />
										<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />
										<br />
										<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        init();<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        solve();<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</span>
						</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    <br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">return</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
		</div>
		<br />
<img src ="http://www.cppblog.com/Darren/aggbug/98083.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Darren/" target="_blank">Darren</a> 2009-10-08 14:54 <a href="http://www.cppblog.com/Darren/archive/2009/10/08/98083.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>HDU   1255</title><link>http://www.cppblog.com/Darren/archive/2009/08/06/92384.html</link><dc:creator>Darren</dc:creator><author>Darren</author><pubDate>Thu, 06 Aug 2009 01:59:00 GMT</pubDate><guid>http://www.cppblog.com/Darren/archive/2009/08/06/92384.html</guid><wfw:comment>http://www.cppblog.com/Darren/comments/92384.html</wfw:comment><comments>http://www.cppblog.com/Darren/archive/2009/08/06/92384.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Darren/comments/commentRss/92384.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Darren/services/trackbacks/92384.html</trackback:ping><description><![CDATA[
		<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
				<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				<span style="COLOR: #000000">#include </span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #000000">iostream</span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />#include </span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #000000">algorithm</span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				</span>
				<span style="COLOR: #0000ff">using</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #0000ff">namespace</span>
				<span style="COLOR: #000000"> std;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #0000ff">#define</span>
				<span style="COLOR: #000000"> N 2110</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
						<br />
						<img id="Codehighlighter1_91_200_Open_Image" onclick="this.style.display='none'; Codehighlighter1_91_200_Open_Text.style.display='none'; Codehighlighter1_91_200_Closed_Image.style.display='inline'; Codehighlighter1_91_200_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" />
						<img id="Codehighlighter1_91_200_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_91_200_Closed_Text.style.display='none'; Codehighlighter1_91_200_Open_Image.style.display='inline'; Codehighlighter1_91_200_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" />
				</span>
				<span style="COLOR: #0000ff">struct</span>
				<span style="COLOR: #000000"> Tree</span>
				<span id="Codehighlighter1_91_200_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
						<img src="http://www.cppblog.com/images/dot.gif" />
				</span>
				<span id="Codehighlighter1_91_200_Open_Text">
						<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">double</span>
						<span style="COLOR: #000000"> length, len;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000">    cnt;<br /><img id="Codehighlighter1_134_155_Open_Image" onclick="this.style.display='none'; Codehighlighter1_134_155_Open_Text.style.display='none'; Codehighlighter1_134_155_Closed_Image.style.display='inline'; Codehighlighter1_134_155_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_134_155_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_134_155_Closed_Text.style.display='none'; Codehighlighter1_134_155_Open_Image.style.display='inline'; Codehighlighter1_134_155_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    Tree()</span>
						<span id="Codehighlighter1_134_155_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
								<img src="http://www.cppblog.com/images/dot.gif" />
						</span>
						<span id="Codehighlighter1_134_155_Open_Text">
								<span style="COLOR: #000000">{ length</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">0</span>
								<span style="COLOR: #000000">; cnt</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">0</span>
								<span style="COLOR: #000000">; }</span>
						</span>
						<span style="COLOR: #000000">
								<br />
								<img id="Codehighlighter1_169_198_Open_Image" onclick="this.style.display='none'; Codehighlighter1_169_198_Open_Text.style.display='none'; Codehighlighter1_169_198_Closed_Image.style.display='inline'; Codehighlighter1_169_198_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />
								<img id="Codehighlighter1_169_198_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_169_198_Closed_Text.style.display='none'; Codehighlighter1_169_198_Open_Image.style.display='inline'; Codehighlighter1_169_198_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">void</span>
						<span style="COLOR: #000000"> init()</span>
						<span id="Codehighlighter1_169_198_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
								<img src="http://www.cppblog.com/images/dot.gif" />
						</span>
						<span id="Codehighlighter1_169_198_Open_Text">
								<span style="COLOR: #000000">{ length</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">0</span>
								<span style="COLOR: #000000">; cnt</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">0</span>
								<span style="COLOR: #000000">; len</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">0</span>
								<span style="COLOR: #000000">; }</span>
						</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
				<span style="COLOR: #000000">tb[</span>
				<span style="COLOR: #000000">10100</span>
				<span style="COLOR: #000000">];<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #0000ff">double</span>
				<span style="COLOR: #000000"> x1[N], y1[N], x2[N], y2[N], xx[N], idx[N];<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> pos, n;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /><br /><img id="Codehighlighter1_287_320_Open_Image" onclick="this.style.display='none'; Codehighlighter1_287_320_Open_Text.style.display='none'; Codehighlighter1_287_320_Closed_Image.style.display='inline'; Codehighlighter1_287_320_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_287_320_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_287_320_Closed_Text.style.display='none'; Codehighlighter1_287_320_Open_Image.style.display='inline'; Codehighlighter1_287_320_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span style="COLOR: #0000ff">struct</span>
				<span style="COLOR: #000000"> Line</span>
				<span id="Codehighlighter1_287_320_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
						<img src="http://www.cppblog.com/images/dot.gif" />
				</span>
				<span id="Codehighlighter1_287_320_Open_Text">
						<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">double</span>
						<span style="COLOR: #000000"> y, x1, x2;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">bool</span>
						<span style="COLOR: #000000"> type;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
				<span style="COLOR: #000000">line[N];<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /><br /><img id="Codehighlighter1_377_397_Open_Image" onclick="this.style.display='none'; Codehighlighter1_377_397_Open_Text.style.display='none'; Codehighlighter1_377_397_Closed_Image.style.display='inline'; Codehighlighter1_377_397_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_377_397_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_377_397_Closed_Text.style.display='none'; Codehighlighter1_377_397_Open_Image.style.display='inline'; Codehighlighter1_377_397_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span style="COLOR: #0000ff">bool</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #0000ff">operator</span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #000000">( Line </span>
				<span style="COLOR: #0000ff">const</span>
				<span style="COLOR: #000000">&amp;</span>
				<span style="COLOR: #000000"> a, Line </span>
				<span style="COLOR: #0000ff">const</span>
				<span style="COLOR: #000000">&amp;</span>
				<span style="COLOR: #000000"> b )</span>
				<span id="Codehighlighter1_377_397_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
						<img src="http://www.cppblog.com/images/dot.gif" />
				</span>
				<span id="Codehighlighter1_377_397_Open_Text">
						<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">return</span>
						<span style="COLOR: #000000"> a.y</span>
						<span style="COLOR: #000000">&lt;</span>
						<span style="COLOR: #000000"> b.y; }</span>
				</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />    <br /><img id="Codehighlighter1_435_615_Open_Image" onclick="this.style.display='none'; Codehighlighter1_435_615_Open_Text.style.display='none'; Codehighlighter1_435_615_Closed_Image.style.display='inline'; Codehighlighter1_435_615_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_435_615_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_435_615_Closed_Text.style.display='none'; Codehighlighter1_435_615_Open_Image.style.display='inline'; Codehighlighter1_435_615_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" />inline </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> bsearch( </span>
				<span style="COLOR: #0000ff">double</span>
				<span style="COLOR: #000000"> value )</span>
				<span id="Codehighlighter1_435_615_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
						<img src="http://www.cppblog.com/images/dot.gif" />
				</span>
				<span id="Codehighlighter1_435_615_Open_Text">
						<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> low</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">1</span>
						<span style="COLOR: #000000">, high</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> pos</span>
						<span style="COLOR: #000000">+</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">1</span>
						<span style="COLOR: #000000">;<br /><img id="Codehighlighter1_484_613_Open_Image" onclick="this.style.display='none'; Codehighlighter1_484_613_Open_Text.style.display='none'; Codehighlighter1_484_613_Closed_Image.style.display='inline'; Codehighlighter1_484_613_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_484_613_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_484_613_Closed_Text.style.display='none'; Codehighlighter1_484_613_Open_Image.style.display='inline'; Codehighlighter1_484_613_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">while</span>
						<span style="COLOR: #000000">( low</span>
						<span style="COLOR: #000000">&lt;=</span>
						<span style="COLOR: #000000"> high )</span>
						<span id="Codehighlighter1_484_613_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
								<img src="http://www.cppblog.com/images/dot.gif" />
						</span>
						<span id="Codehighlighter1_484_613_Open_Text">
								<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">int</span>
								<span style="COLOR: #000000"> mid</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> (low</span>
								<span style="COLOR: #000000">+</span>
								<span style="COLOR: #000000"> high)</span>
								<span style="COLOR: #000000">&gt;&gt;</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">1</span>
								<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">if</span>
								<span style="COLOR: #000000">( idx[mid]</span>
								<span style="COLOR: #000000">&gt;</span>
								<span style="COLOR: #000000"> value ) high</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> mid</span>
								<span style="COLOR: #000000">-</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">1</span>
								<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">else</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #0000ff">if</span>
								<span style="COLOR: #000000">( idx[mid]</span>
								<span style="COLOR: #000000">&lt;</span>
								<span style="COLOR: #000000"> value ) low</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> mid</span>
								<span style="COLOR: #000000">+</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">1</span>
								<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">else</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #0000ff">return</span>
								<span style="COLOR: #000000"> mid; }</span>
						</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
						<br />
						<img id="Codehighlighter1_660_811_Open_Image" onclick="this.style.display='none'; Codehighlighter1_660_811_Open_Text.style.display='none'; Codehighlighter1_660_811_Closed_Image.style.display='inline'; Codehighlighter1_660_811_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" />
						<img id="Codehighlighter1_660_811_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_660_811_Closed_Text.style.display='none'; Codehighlighter1_660_811_Open_Image.style.display='inline'; Codehighlighter1_660_811_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" />inline </span>
				<span style="COLOR: #0000ff">void</span>
				<span style="COLOR: #000000"> update( </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> rt, </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> l, </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> r )</span>
				<span id="Codehighlighter1_660_811_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
						<img src="http://www.cppblog.com/images/dot.gif" />
				</span>
				<span id="Codehighlighter1_660_811_Open_Text">
						<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">if</span>
						<span style="COLOR: #000000">( tb[rt].cnt ) tb[rt].length</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> idx[r]</span>
						<span style="COLOR: #000000">-</span>
						<span style="COLOR: #000000"> idx[l];<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">else</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">if</span>
						<span style="COLOR: #000000">( l</span>
						<span style="COLOR: #000000">+</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">1</span>
						<span style="COLOR: #000000">==</span>
						<span style="COLOR: #000000"> r ) tb[rt].length</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">else</span>
						<span style="COLOR: #000000"> tb[rt].length</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> tb[rt</span>
						<span style="COLOR: #000000">&lt;&lt;</span>
						<span style="COLOR: #000000">1</span>
						<span style="COLOR: #000000">].length</span>
						<span style="COLOR: #000000">+</span>
						<span style="COLOR: #000000"> tb[(rt</span>
						<span style="COLOR: #000000">&lt;&lt;</span>
						<span style="COLOR: #000000">1</span>
						<span style="COLOR: #000000">)</span>
						<span style="COLOR: #000000">+</span>
						<span style="COLOR: #000000">1</span>
						<span style="COLOR: #000000">].length;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
						<br />
						<img id="Codehighlighter1_857_1039_Open_Image" onclick="this.style.display='none'; Codehighlighter1_857_1039_Open_Text.style.display='none'; Codehighlighter1_857_1039_Closed_Image.style.display='inline'; Codehighlighter1_857_1039_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" />
						<img id="Codehighlighter1_857_1039_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_857_1039_Closed_Text.style.display='none'; Codehighlighter1_857_1039_Open_Image.style.display='inline'; Codehighlighter1_857_1039_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" />inline </span>
				<span style="COLOR: #0000ff">void</span>
				<span style="COLOR: #000000"> update2( </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> rt, </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> l, </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> r )</span>
				<span id="Codehighlighter1_857_1039_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
						<img src="http://www.cppblog.com/images/dot.gif" />
				</span>
				<span id="Codehighlighter1_857_1039_Open_Text">
						<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">if</span>
						<span style="COLOR: #000000">( tb[rt].cnt</span>
						<span style="COLOR: #000000">&gt;</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">1</span>
						<span style="COLOR: #000000"> ) tb[rt].len</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> idx[r]</span>
						<span style="COLOR: #000000">-</span>
						<span style="COLOR: #000000"> idx[l];<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">else</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">if</span>
						<span style="COLOR: #000000">( tb[rt].cnt</span>
						<span style="COLOR: #000000">==</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">1</span>
						<span style="COLOR: #000000"> ) tb[rt].len</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> tb[rt</span>
						<span style="COLOR: #000000">&lt;&lt;</span>
						<span style="COLOR: #000000">1</span>
						<span style="COLOR: #000000">].length</span>
						<span style="COLOR: #000000">+</span>
						<span style="COLOR: #000000"> tb[(rt</span>
						<span style="COLOR: #000000">&lt;&lt;</span>
						<span style="COLOR: #000000">1</span>
						<span style="COLOR: #000000">)</span>
						<span style="COLOR: #000000">+</span>
						<span style="COLOR: #000000">1</span>
						<span style="COLOR: #000000">].length;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">else</span>
						<span style="COLOR: #000000"> tb[rt].len</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> tb[rt</span>
						<span style="COLOR: #000000">&lt;&lt;</span>
						<span style="COLOR: #000000">1</span>
						<span style="COLOR: #000000">].len</span>
						<span style="COLOR: #000000">+</span>
						<span style="COLOR: #000000"> tb[(rt</span>
						<span style="COLOR: #000000">&lt;&lt;</span>
						<span style="COLOR: #000000">1</span>
						<span style="COLOR: #000000">)</span>
						<span style="COLOR: #000000">+</span>
						<span style="COLOR: #000000">1</span>
						<span style="COLOR: #000000">].len; }</span>
				</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
						<br />
						<img id="Codehighlighter1_1096_1357_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1096_1357_Open_Text.style.display='none'; Codehighlighter1_1096_1357_Closed_Image.style.display='inline'; Codehighlighter1_1096_1357_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" />
						<img id="Codehighlighter1_1096_1357_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1096_1357_Closed_Text.style.display='none'; Codehighlighter1_1096_1357_Open_Image.style.display='inline'; Codehighlighter1_1096_1357_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" />
				</span>
				<span style="COLOR: #0000ff">void</span>
				<span style="COLOR: #000000"> deal( </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> rt, </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> l, </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> r, </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> a, </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> b, </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> t )</span>
				<span id="Codehighlighter1_1096_1357_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
						<img src="http://www.cppblog.com/images/dot.gif" />
				</span>
				<span id="Codehighlighter1_1096_1357_Open_Text">
						<span style="COLOR: #000000">{<br /><img id="Codehighlighter1_1119_1189_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1119_1189_Open_Text.style.display='none'; Codehighlighter1_1119_1189_Closed_Image.style.display='inline'; Codehighlighter1_1119_1189_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_1119_1189_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1119_1189_Closed_Text.style.display='none'; Codehighlighter1_1119_1189_Open_Image.style.display='inline'; Codehighlighter1_1119_1189_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">if</span>
						<span style="COLOR: #000000">( a</span>
						<span style="COLOR: #000000">&lt;=</span>
						<span style="COLOR: #000000"> l </span>
						<span style="COLOR: #000000">&amp;&amp;</span>
						<span style="COLOR: #000000"> b</span>
						<span style="COLOR: #000000">&gt;=</span>
						<span style="COLOR: #000000"> r )</span>
						<span id="Codehighlighter1_1119_1189_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
								<img src="http://www.cppblog.com/images/dot.gif" />
						</span>
						<span id="Codehighlighter1_1119_1189_Open_Text">
								<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />        tb[rt].cnt</span>
								<span style="COLOR: #000000">+=</span>
								<span style="COLOR: #000000"> t; update( rt, l, r ); update2( rt, l, r );  </span>
								<span style="COLOR: #0000ff">return</span>
								<span style="COLOR: #000000">; }</span>
						</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        <br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> mid</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> (l</span>
						<span style="COLOR: #000000">+</span>
						<span style="COLOR: #000000"> r)</span>
						<span style="COLOR: #000000">&gt;&gt;</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">1</span>
						<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">if</span>
						<span style="COLOR: #000000">( a</span>
						<span style="COLOR: #000000">&lt;</span>
						<span style="COLOR: #000000"> mid ) deal( rt</span>
						<span style="COLOR: #000000">&lt;&lt;</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">1</span>
						<span style="COLOR: #000000">, l, mid, a, b, t);<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">if</span>
						<span style="COLOR: #000000">( b</span>
						<span style="COLOR: #000000">&gt;</span>
						<span style="COLOR: #000000"> mid ) deal( (rt</span>
						<span style="COLOR: #000000">&lt;&lt;</span>
						<span style="COLOR: #000000">1</span>
						<span style="COLOR: #000000">)</span>
						<span style="COLOR: #000000">+</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">1</span>
						<span style="COLOR: #000000">, mid, r, a, b, t );<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    <br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    update( rt, l, r ); update2( rt, l, r );<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
						<br />
						<img id="Codehighlighter1_1370_2269_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1370_2269_Open_Text.style.display='none'; Codehighlighter1_1370_2269_Closed_Image.style.display='inline'; Codehighlighter1_1370_2269_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" />
						<img id="Codehighlighter1_1370_2269_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1370_2269_Closed_Text.style.display='none'; Codehighlighter1_1370_2269_Open_Image.style.display='inline'; Codehighlighter1_1370_2269_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" />
				</span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> main()</span>
				<span id="Codehighlighter1_1370_2269_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
						<img src="http://www.cppblog.com/images/dot.gif" />
				</span>
				<span id="Codehighlighter1_1370_2269_Open_Text">
						<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> test</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">1</span>
						<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    scanf(</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">%d</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">,</span>
						<span style="COLOR: #000000">&amp;</span>
						<span style="COLOR: #000000">test );<br /><img id="Codehighlighter1_1423_2254_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1423_2254_Open_Text.style.display='none'; Codehighlighter1_1423_2254_Closed_Image.style.display='inline'; Codehighlighter1_1423_2254_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_1423_2254_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1423_2254_Closed_Text.style.display='none'; Codehighlighter1_1423_2254_Open_Image.style.display='inline'; Codehighlighter1_1423_2254_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">while</span>
						<span style="COLOR: #000000">( test</span>
						<span style="COLOR: #000000">--</span>
						<span style="COLOR: #000000"> )</span>
						<span id="Codehighlighter1_1423_2254_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
								<img src="http://www.cppblog.com/images/dot.gif" />
						</span>
						<span id="Codehighlighter1_1423_2254_Open_Text">
								<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        scanf(</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">%d</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">,</span>
								<span style="COLOR: #000000">&amp;</span>
								<span style="COLOR: #000000">n);<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">for</span>
								<span style="COLOR: #000000">( </span>
								<span style="COLOR: #0000ff">int</span>
								<span style="COLOR: #000000"> i</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">0</span>
								<span style="COLOR: #000000">; i</span>
								<span style="COLOR: #000000">&lt;=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">10000</span>
								<span style="COLOR: #000000">; </span>
								<span style="COLOR: #000000">++</span>
								<span style="COLOR: #000000">i ) tb[i].init();<br /><img id="Codehighlighter1_1520_1808_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1520_1808_Open_Text.style.display='none'; Codehighlighter1_1520_1808_Closed_Image.style.display='inline'; Codehighlighter1_1520_1808_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_1520_1808_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1520_1808_Closed_Text.style.display='none'; Codehighlighter1_1520_1808_Open_Image.style.display='inline'; Codehighlighter1_1520_1808_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">for</span>
								<span style="COLOR: #000000">( </span>
								<span style="COLOR: #0000ff">int</span>
								<span style="COLOR: #000000"> i</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">0</span>
								<span style="COLOR: #000000">; i</span>
								<span style="COLOR: #000000">&lt;</span>
								<span style="COLOR: #000000"> n; </span>
								<span style="COLOR: #000000">++</span>
								<span style="COLOR: #000000">i ) </span>
								<span id="Codehighlighter1_1520_1808_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
										<img src="http://www.cppblog.com/images/dot.gif" />
								</span>
								<span id="Codehighlighter1_1520_1808_Open_Text">
										<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            scanf(</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">%lf%lf%lf%lf</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">, x1</span>
										<span style="COLOR: #000000">+</span>
										<span style="COLOR: #000000"> i, y1</span>
										<span style="COLOR: #000000">+</span>
										<span style="COLOR: #000000"> i, x2</span>
										<span style="COLOR: #000000">+</span>
										<span style="COLOR: #000000"> i, y2</span>
										<span style="COLOR: #000000">+</span>
										<span style="COLOR: #000000"> i );<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            line[</span>
										<span style="COLOR: #000000">2</span>
										<span style="COLOR: #000000">*</span>
										<span style="COLOR: #000000">i].y</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> y1[i];   line[</span>
										<span style="COLOR: #000000">2</span>
										<span style="COLOR: #000000">*</span>
										<span style="COLOR: #000000">i].x1</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> x1[i]; <br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            line[</span>
										<span style="COLOR: #000000">2</span>
										<span style="COLOR: #000000">*</span>
										<span style="COLOR: #000000">i].x2</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> x2[i];  line[</span>
										<span style="COLOR: #000000">2</span>
										<span style="COLOR: #000000">*</span>
										<span style="COLOR: #000000">i].type</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #000000">0</span>
										<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            <br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            xx[</span>
										<span style="COLOR: #000000">2</span>
										<span style="COLOR: #000000">*</span>
										<span style="COLOR: #000000">i]</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> x1[i]; xx[</span>
										<span style="COLOR: #000000">2</span>
										<span style="COLOR: #000000">*</span>
										<span style="COLOR: #000000">i</span>
										<span style="COLOR: #000000">+</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #000000">1</span>
										<span style="COLOR: #000000">]</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> x2[i];<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            line[</span>
										<span style="COLOR: #000000">2</span>
										<span style="COLOR: #000000">*</span>
										<span style="COLOR: #000000">i</span>
										<span style="COLOR: #000000">+</span>
										<span style="COLOR: #000000">1</span>
										<span style="COLOR: #000000">].y</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> y2[i];  line[</span>
										<span style="COLOR: #000000">2</span>
										<span style="COLOR: #000000">*</span>
										<span style="COLOR: #000000">i</span>
										<span style="COLOR: #000000">+</span>
										<span style="COLOR: #000000">1</span>
										<span style="COLOR: #000000">].x1</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> x1[i];<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            line[</span>
										<span style="COLOR: #000000">2</span>
										<span style="COLOR: #000000">*</span>
										<span style="COLOR: #000000">i</span>
										<span style="COLOR: #000000">+</span>
										<span style="COLOR: #000000">1</span>
										<span style="COLOR: #000000">].x2</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> x2[i]; line[</span>
										<span style="COLOR: #000000">2</span>
										<span style="COLOR: #000000">*</span>
										<span style="COLOR: #000000">i</span>
										<span style="COLOR: #000000">+</span>
										<span style="COLOR: #000000">1</span>
										<span style="COLOR: #000000">].type</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #000000">1</span>
										<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />        }</span>
								</span>
								<span style="COLOR: #000000">
										<br />
										<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        sort( xx, xx</span>
								<span style="COLOR: #000000">+</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">2</span>
								<span style="COLOR: #000000">*</span>
								<span style="COLOR: #000000"> n );    sort( line, line</span>
								<span style="COLOR: #000000">+</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">2</span>
								<span style="COLOR: #000000">*</span>
								<span style="COLOR: #000000"> n );<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        pos</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">1</span>
								<span style="COLOR: #000000">; idx[</span>
								<span style="COLOR: #000000">1</span>
								<span style="COLOR: #000000">]</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> xx[</span>
								<span style="COLOR: #000000">0</span>
								<span style="COLOR: #000000">];<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">for</span>
								<span style="COLOR: #000000">( </span>
								<span style="COLOR: #0000ff">int</span>
								<span style="COLOR: #000000"> i</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">1</span>
								<span style="COLOR: #000000">; i</span>
								<span style="COLOR: #000000">&lt;</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">2</span>
								<span style="COLOR: #000000">*</span>
								<span style="COLOR: #000000"> n; </span>
								<span style="COLOR: #000000">++</span>
								<span style="COLOR: #000000">i )<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">if</span>
								<span style="COLOR: #000000">( xx[i]</span>
								<span style="COLOR: #000000">!=</span>
								<span style="COLOR: #000000"> xx[i</span>
								<span style="COLOR: #000000">-</span>
								<span style="COLOR: #000000">1</span>
								<span style="COLOR: #000000">] ) idx[</span>
								<span style="COLOR: #000000">++</span>
								<span style="COLOR: #000000">pos]</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> xx[i];<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        <br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">double</span>
								<span style="COLOR: #000000"> ans</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">0</span>
								<span style="COLOR: #000000">;<br /><img id="Codehighlighter1_2017_2223_Open_Image" onclick="this.style.display='none'; Codehighlighter1_2017_2223_Open_Text.style.display='none'; Codehighlighter1_2017_2223_Closed_Image.style.display='inline'; Codehighlighter1_2017_2223_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_2017_2223_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_2017_2223_Closed_Text.style.display='none'; Codehighlighter1_2017_2223_Open_Image.style.display='inline'; Codehighlighter1_2017_2223_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">for</span>
								<span style="COLOR: #000000">( </span>
								<span style="COLOR: #0000ff">int</span>
								<span style="COLOR: #000000"> i</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">0</span>
								<span style="COLOR: #000000">; i</span>
								<span style="COLOR: #000000">&lt;</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">2</span>
								<span style="COLOR: #000000">*</span>
								<span style="COLOR: #000000"> n</span>
								<span style="COLOR: #000000">-</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">1</span>
								<span style="COLOR: #000000">; </span>
								<span style="COLOR: #000000">++</span>
								<span style="COLOR: #000000">i )</span>
								<span id="Codehighlighter1_2017_2223_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
										<img src="http://www.cppblog.com/images/dot.gif" />
								</span>
								<span id="Codehighlighter1_2017_2223_Open_Text">
										<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
										<span style="COLOR: #0000ff">int</span>
										<span style="COLOR: #000000"> u</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> bsearch( line[i].x1 ), v</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> bsearch( line[i].x2 );<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
										<span style="COLOR: #0000ff">if</span>
										<span style="COLOR: #000000">( line[i].type</span>
										<span style="COLOR: #000000">==</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #000000">0</span>
										<span style="COLOR: #000000"> ) deal( </span>
										<span style="COLOR: #000000">1</span>
										<span style="COLOR: #000000">, </span>
										<span style="COLOR: #000000">1</span>
										<span style="COLOR: #000000">, pos, u, v, </span>
										<span style="COLOR: #000000">1</span>
										<span style="COLOR: #000000"> );<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
										<span style="COLOR: #0000ff">else</span>
										<span style="COLOR: #000000"> deal( </span>
										<span style="COLOR: #000000">1</span>
										<span style="COLOR: #000000">, </span>
										<span style="COLOR: #000000">1</span>
										<span style="COLOR: #000000">, pos, u, v, </span>
										<span style="COLOR: #000000">-</span>
										<span style="COLOR: #000000">1</span>
										<span style="COLOR: #000000"> );<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            <br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            ans</span>
										<span style="COLOR: #000000">+=</span>
										<span style="COLOR: #000000"> tb[</span>
										<span style="COLOR: #000000">1</span>
										<span style="COLOR: #000000">].len</span>
										<span style="COLOR: #000000">*</span>
										<span style="COLOR: #000000"> ( line[i</span>
										<span style="COLOR: #000000">+</span>
										<span style="COLOR: #000000">1</span>
										<span style="COLOR: #000000">].y</span>
										<span style="COLOR: #000000">-</span>
										<span style="COLOR: #000000"> line[i].y );<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />        }</span>
								</span>
								<span style="COLOR: #000000">
										<br />
										<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        printf(</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">%.2lf\n</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">, ans );<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</span>
						</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    <br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">return</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				</span>
		</div>
<img src ="http://www.cppblog.com/Darren/aggbug/92384.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Darren/" target="_blank">Darren</a> 2009-08-06 09:59 <a href="http://www.cppblog.com/Darren/archive/2009/08/06/92384.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>PKU　　1151</title><link>http://www.cppblog.com/Darren/archive/2009/08/06/92365.html</link><dc:creator>Darren</dc:creator><author>Darren</author><pubDate>Wed, 05 Aug 2009 16:49:00 GMT</pubDate><guid>http://www.cppblog.com/Darren/archive/2009/08/06/92365.html</guid><wfw:comment>http://www.cppblog.com/Darren/comments/92365.html</wfw:comment><comments>http://www.cppblog.com/Darren/archive/2009/08/06/92365.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Darren/comments/commentRss/92365.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Darren/services/trackbacks/92365.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: #include 				&lt;				iostream				&gt;																#include 				&lt;				algorithm				&gt;																																				using				 				namespace				 std;	...&nbsp;&nbsp;<a href='http://www.cppblog.com/Darren/archive/2009/08/06/92365.html'>阅读全文</a><img src ="http://www.cppblog.com/Darren/aggbug/92365.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Darren/" target="_blank">Darren</a> 2009-08-06 00:49 <a href="http://www.cppblog.com/Darren/archive/2009/08/06/92365.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>2009年ACM-ICPC亚洲区预选赛共设十五个赛区如下(按现场赛日期排序)</title><link>http://www.cppblog.com/Darren/archive/2009/08/04/92216.html</link><dc:creator>Darren</dc:creator><author>Darren</author><pubDate>Tue, 04 Aug 2009 13:35:00 GMT</pubDate><guid>http://www.cppblog.com/Darren/archive/2009/08/04/92216.html</guid><wfw:comment>http://www.cppblog.com/Darren/comments/92216.html</wfw:comment><comments>http://www.cppblog.com/Darren/archive/2009/08/04/92216.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cppblog.com/Darren/comments/commentRss/92216.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Darren/services/trackbacks/92216.html</trackback:ping><description><![CDATA[<p>1、Harbin 哈尔滨赛区（哈尔滨工业大学）<br>网络选拔赛日期：2009年9月13日 14:00-17:00<br>现场赛日期：2009年9月26日～27日<br><a href="http://acm.hit.edu.cn/"><u><font color=#0000ff>http://acm.hit.edu.cn/</font></u></a> <br><br>2、Dhaka 达卡赛区（孟加拉国 Northsouth University）<br>现场赛日期：2009年10月3日<br><a href="http://www.northsouth.edu/acm/"><u><font color=#0000ff>http://www.northsouth.edu/acm/</font></u></a> <br><br>3、Gwalior-Kanpur 瓜廖尔-坎普尔赛区（印度 IIITM Gwalior and Indian Institute of Technology, India）<br>现场赛日期：2009年10月3日～4日<br><a href="http://www.cse.iitk.ac.in/users/acm/"><u><font color=#0000ff>http://www.cse.iitk.ac.in/users/acm/</font></u></a> </p>
<p>4、Hefei 合肥赛区（中国科学技术大学）<br>网络选拔赛日期：2009年9月6日 14:00-17:00<br>现场赛日期：2009年10月10日～11日<br><a href="http://acm.ustc.edu.cn/"><u><font color=#810081>http://acm.ustc.edu.cn/</font></u></a> </p>
<p>5、Ningbo 宁波赛区（浙江大学宁波理工学院）<br>网络选拔赛日期：2009年9月12日<br>现场赛日期：2009年10月17日～18日<br><a href="http://acmasia09.nit.net.cn/"><u><font color=#0000ff>http://acmasia09.nit.net.cn/</font></u></a> </p>
<p>6、Jakarta 雅加达赛区（印尼 Binus University）<br>现场赛日期：2009年10月21日<br><a href="http://icpc.ewubd.edu/"><u><font color=#0000ff>http://icpc.ewubd.edu/</font></u></a> </p>
<p>7、Manila 马尼拉赛区（菲律宾 Ateneo de Manila University）<br>现场赛日期：2009年10月22日～23日<br><a href="http://www.math.admu.edu.ph/acm/"><u><font color=#0000ff>http://www.math.admu.edu.ph/acm/</font></u></a> <br></p>
<p>8、Shanghai 上海赛区（东华大学）<br>网络选拔赛日期：2009年9月20日(12:00-17:00)<br>现场赛日期：2009年10月24日～25日<br><a href="http://acm.dhu.edu.cn/"><u><font color=#0000ff>http://acm.dhu.edu.cn</font></u></a> </p>
<p>9、Hsinchu 新竹赛区（交通大学）<br>报名截止日期：2009年8月19日<br>现场赛日期：2009年10月30日～31日<br><a href="http://icpc2009.nctu.edu.tw/"><u><font color=#0000ff>http://icpc2009.nctu.edu.tw/</font></u></a> <br></p>
<p>10、Wuhan 武汉赛区（武汉大学）<br>网络选拔赛日期：2009年10月3<br>现场赛日期：2009年10月31日～11月1日<br><a href="http://acm.whu.edu.cn/"><u><font color=#810081>http://acm.whu.edu.cn/</font></u></a> </p>
<p>11、Amritapuri 阿姆里塔普里赛区（印度 Amrita Vishwa Vidyapeetham, Amritapuri Campus）<br>现场赛日期：2009年11月1日<br><a href="http://icpc.amrita.ac.in/"><u><font color=#0000ff>http://icpc.amrita.ac.in/</font></u></a> </p>
<p>12、Phuket 普吉岛赛区（泰国 Prince of Songkla University, Phuket Campus）<br>报名截止日期：2009年9月30日<br>现场赛日期：2009年11月3日～4日<br><a href="http://www.acmicpc-thailand.org/"><u><font color=#0000ff>http://www.acmicpc-thailand.org/</font></u></a> </p>
<p>13、Seoul 首尔赛区（韩国 Korea Advanced Institute of Science and Technology）<br>报名截止日期：2009年9月11日<br>现场赛日期：2009年11月5日～6日<br><a href="http://acm.kaist.ac.kr/"><u><font color=#0000ff>http://acm.kaist.ac.kr/</font></u></a> </p>
<p>14、Tehran 德黑兰赛区（伊朗 Sharif University of Technology）<br>现场赛日期：2009年11月6日<br><a href="http://sharif.edu/~acmicpc"><u><font color=#0000ff>http://sharif.edu/~acmicpc</font></u></a> </p>
<p>15、Tokyo 东京赛区（日本早稻田大学）<br>现场赛日期：2009年11月7日～8日<br><a href="http://www.waseda.jp/assoc-icpc2009/en/index.html"><u><font color=#810081>http://www.waseda.jp/assoc-icpc2009/en/index.html</font></u></a> <br></p>
<h2>参赛报名网址</h2>
<p><a href="http://cm.baylor.edu/welcome.icpc"><u><font color=#810081>http://cm.baylor.edu/welcome.icpc</font></u></a> </p>
<p>亚洲高校可组队参加全部十五个赛区的预选赛，但每位参赛选手最多只能注册参加<strong>两个赛区</strong>的预选赛。</p>
<img src ="http://www.cppblog.com/Darren/aggbug/92216.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Darren/" target="_blank">Darren</a> 2009-08-04 21:35 <a href="http://www.cppblog.com/Darren/archive/2009/08/04/92216.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>acmer必看的26个对acm态度</title><link>http://www.cppblog.com/Darren/archive/2009/08/03/92099.html</link><dc:creator>Darren</dc:creator><author>Darren</author><pubDate>Mon, 03 Aug 2009 14:05:00 GMT</pubDate><guid>http://www.cppblog.com/Darren/archive/2009/08/03/92099.html</guid><wfw:comment>http://www.cppblog.com/Darren/comments/92099.html</wfw:comment><comments>http://www.cppblog.com/Darren/archive/2009/08/03/92099.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.cppblog.com/Darren/comments/commentRss/92099.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Darren/services/trackbacks/92099.html</trackback:ping><description><![CDATA[<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%; widows: 2; orphans: 2" align=left><u><strong>Attempt</strong></u></p>
<br>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%; widows: 2; orphans: 2" align=left><font face="Batang, &#48148;&#53461;, serif">Keep on attempting!</font><font face="Batang, &#48148;&#53461;, serif"> </font><br></p>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%; widows: 2; orphans: 2" align=left><font face="DejaVu Sans">尝试<font face="Batang, &#48148;&#53461;, serif">，</font>尝试<font face="Batang, &#48148;&#53461;, serif">，再</font>尝试<font face="Batang, &#48148;&#53461;, serif">！</font></font></p>
<br>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%; widows: 2; orphans: 2" align=left><u><strong>Bravery</strong></u></p>
<br>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%; widows: 2; orphans: 2" align=left><font face="Batang, &#48148;&#53461;, serif">Never lose heart, be sure you are brave enough to face failure!</font><br></p>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%; widows: 2; orphans: 2" align=left><font face="DejaVu Sans"><font face="Batang, &#48148;&#53461;, serif">勇敢地跨</font>过<font face="Batang, &#48148;&#53461;, serif">失</font>败<font face="Batang, &#48148;&#53461;, serif">，成功就在前方。</font></font></p>
<br>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%; widows: 2; orphans: 2" align=left><u><strong>Cooperation</strong></u></p>
<br>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%; widows: 2; orphans: 2" align=left><font face="Batang, &#48148;&#53461;, serif">It is teamwork, you are not alone. </font><br></p>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%; widows: 2; orphans: 2" align=left><font face="DejaVu Sans">我们是作为一个团队一起努力的<font face="Batang, &#48148;&#53461;, serif">。</font></font></p>
<br>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%; widows: 2; orphans: 2" align=left><u><strong>Diligence</strong></u></p>
<br>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%; widows: 2; orphans: 2" align=left><font face="Batang, &#48148;&#53461;, serif">Working hard, and bear abundant fruit.</font><font face="Batang, &#48148;&#53461;, serif"> </font><br></p>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%; widows: 2; orphans: 2" align=left><font face="DejaVu Sans">一份耕耘，一份收获！</font></p>
<br>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%; widows: 2; orphans: 2" align=left><u><strong>Enjoy</strong></u></p>
<br>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%; widows: 2; orphans: 2" align=left><font face="Batang, &#48148;&#53461;, serif">Enjoy the work.</font><font face="Batang, &#48148;&#53461;, serif"> </font><br></p>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%; widows: 2; orphans: 2" align=left><font face="DejaVu Sans">态度决定一切，</font>ACM-ICPC<font face="DejaVu Sans">是快乐的！</font></p>
<br>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%; widows: 2; orphans: 2" align=left><u><strong>Facility</strong></u></p>
<br>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%; widows: 2; orphans: 2" align=left><font face="Batang, &#48148;&#53461;, serif">Facility in programming promise the champion.</font><br></p>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%; widows: 2; orphans: 2" align=left><font face="DejaVu Sans">扎实的编程能力是夺冠的有力支柱。</font></p>
<br>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%; widows: 2; orphans: 2" align=left><u><strong>Galaxy</strong></u></p>
<br>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%; widows: 2; orphans: 2" align=left><font face="Batang, &#48148;&#53461;, serif">ACM-ICPC is just a galaxy.</font><font face="Batang, &#48148;&#53461;, serif"> </font><br></p>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%; widows: 2; orphans: 2" align=left><font face="DejaVu Sans">群英聚会方显王者本色。</font></p>
<br>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%; widows: 2; orphans: 2" align=left><u><strong>Honor</strong></u></p>
<br>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%; widows: 2; orphans: 2" align=left><font face="Batang, &#48148;&#53461;, serif">It is great honor to try the contest.</font><br></p>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%; widows: 2; orphans: 2" align=left>ACM<font face="DejaVu Sans">，一次无悔的尝试，一段精彩的人生。</font></p>
<br>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%; widows: 2; orphans: 2" align=left><u><strong>Intelligence</strong></u></p>
<br>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%; widows: 2; orphans: 2" align=left><font face="Batang, &#48148;&#53461;, serif">Who is the cleverest?</font><font face="Batang, &#48148;&#53461;, serif"> </font><br></p>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%; widows: 2; orphans: 2" align=left><font face="DejaVu Sans">一场智慧的较量。</font></p>
<br>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%; widows: 2; orphans: 2" align=left><u><strong>Judger</strong></u></p>
<br>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%; widows: 2; orphans: 2" align=left><font face="Batang, &#48148;&#53461;, serif">Judge in the contest as God in the world.</font><font face="Batang, &#48148;&#53461;, serif"> </font><br></p>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%; widows: 2; orphans: 2" align=left><font face="DejaVu Sans">裁判于</font>ACM<font face="DejaVu Sans">，就如同上帝于世界。 </font></p>
<br>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%; widows: 2; orphans: 2" align=left><u><strong>Knotty</strong></u></p>
<br>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%; widows: 2; orphans: 2" align=left><font face="Batang, &#48148;&#53461;, serif">The way to champion is knotty.</font><font face="Batang, &#48148;&#53461;, serif"> </font><br></p>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%; widows: 2; orphans: 2" align=left><font face="DejaVu Sans">冠军之路铺满荆棘。</font></p>
<br>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%; widows: 2; orphans: 2" align=left><u><strong>Lucky</strong></u></p>
<br>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%; widows: 2; orphans: 2" align=left><font face="Batang, &#48148;&#53461;, serif">Luck permit</font><font face="Batang, &#48148;&#53461;, serif">s</font><font face="Batang, &#48148;&#53461;, serif">!</font><font face="Batang, &#48148;&#53461;, serif"> </font><br></p>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%; widows: 2; orphans: 2" align=left>ACM<font face="DejaVu Sans">，一切皆有可能。</font></p>
<br>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%; widows: 2; orphans: 2" align=left><u><strong>Magic</strong></u></p>
<br>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%; widows: 2; orphans: 2" align=left><font face="Batang, &#48148;&#53461;, serif">Magic ideas work wonder.</font><br></p>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%; widows: 2; orphans: 2" align=left><font face="DejaVu Sans">灵光一闪的瞬间，我们知道</font>ACM<font face="DejaVu Sans">原来是一场神话的挑战。</font></p>
<br>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%; widows: 2; orphans: 2" align=left><u><strong>Naturally </strong></u></p>
<br>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%; widows: 2; orphans: 2" align=left><font face="Batang, &#48148;&#53461;, serif">It&#8217;s naturally for us to win the ACM. </font><br></p>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%; widows: 2; orphans: 2" align=left><font face="DejaVu Sans">用我们的胜利来诠释曾经的努力，艰辛和坚信！</font></p>
<br>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%"><u><strong>Objective </strong></u></p>
<br>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%"><font face="Batang, &#48148;&#53461;, serif">To achieve the objective is always in the next second&#8230;</font><br></p>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%"><font face="DejaVu Sans">或许我们更大的收获在于我们之间许下牢不可破的誓言&#8230;</font></p>
<br>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%"></p>
<br>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%"><u><strong>Parents </strong></u></p>
<br>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%"><font face="Batang, &#48148;&#53461;, serif">On this long hard load, we wonder, we hesitate. It&#8217;s your power push me forward, my parents! </font><br></p>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%"><font face="DejaVu Sans">我爱你们！亲爱的爸爸妈妈</font>~</p>
<br>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%"><u><strong>Quality </strong></u></p>
<br>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%"><font face="Batang, &#48148;&#53461;, serif">The quality of a contest should be focus on person rather than skill. </font><br></p>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%"><font face="DejaVu Sans">总有更闪亮的星耀眼于深邃的夜空&#8230;</font></p>
<br>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%"><u><strong>Schedule </strong></u></p>
<br>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%"><font face="Batang, &#48148;&#53461;, serif">There always exists something out of schedule. </font><br></p>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%"><font face="DejaVu Sans">从时间表上我们看见催促看见赛程还有气球、还有未来&#8230;</font></p>
<br>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%"><u><strong>Team </strong></u></p>
<br>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%"><font face="Batang, &#48148;&#53461;, serif">The honor belongs to our team! Come on!</font><br></p>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%"><font face="DejaVu Sans">一切来自</font>ACM<font face="DejaVu Sans">的契机，感激他让我们相识。</font></p>
<br>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%"><u><strong>University </strong></u></p>
<br>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%"><font face="Batang, &#48148;&#53461;, serif">Shang hai Jiaotong University records my growing.</font><br></p>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%"><font face="DejaVu Sans">也许有一天思源湖会冠上我的名字</font>~</p>
<br>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%"><u><strong>Victory</strong></u></p>
<br>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%"><font face="Batang, &#48148;&#53461;, serif">Two for victory</font>~</p>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%"><font face="DejaVu Sans">永远记得对着镜头我们的笑那么灿烂。</font></p>
<br>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%"><u><strong>Wing </strong></u></p>
<br>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%"><font face="Batang, &#48148;&#53461;, serif">We came to the fore, flew without wings.</font><br></p>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%"><font face="DejaVu Sans">是天使赋予了我飞翔的翅膀，我用它举起了</font>ACM<font face="DejaVu Sans">的奖杯。</font></p>
<br>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%"><u><strong>X</strong></u></p>
<br>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%"><font face="Batang, &#48148;&#53461;, serif">We fight against the x!</font><br></p>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%"><font face="DejaVu Sans">面对未知，是我们睁大好奇的双眼，也是我们无畏的向前，奔赴远方。</font></p>
<br>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%"><u><strong>Yesterday</strong></u></p>
<br>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%"><font face="Batang, &#48148;&#53461;, serif">Yesterday once more.</font><br></p>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%"><font face="DejaVu Sans">回眸那些辉煌，唯有忘却才能凯旋！</font></p>
<br>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%"><u><strong>Zero</strong></u></p>
<br>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%"><font face="Batang, &#48148;&#53461;, serif">All begin with zero&#8230;</font><br></p>
<p style="MARGIN-BOTTOM: 0cm; LINE-HEIGHT: 180%"><font face="DejaVu Sans">我们站在新的起点上，整装待发！</font></p>
<img src ="http://www.cppblog.com/Darren/aggbug/92099.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Darren/" target="_blank">Darren</a> 2009-08-03 22:05 <a href="http://www.cppblog.com/Darren/archive/2009/08/03/92099.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ZJU  3228  Searching the String ( AC 自动机 )</title><link>http://www.cppblog.com/Darren/archive/2009/08/02/91977.html</link><dc:creator>Darren</dc:creator><author>Darren</author><pubDate>Sun, 02 Aug 2009 14:05:00 GMT</pubDate><guid>http://www.cppblog.com/Darren/archive/2009/08/02/91977.html</guid><wfw:comment>http://www.cppblog.com/Darren/comments/91977.html</wfw:comment><comments>http://www.cppblog.com/Darren/archive/2009/08/02/91977.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cppblog.com/Darren/comments/commentRss/91977.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Darren/services/trackbacks/91977.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: #include 				&lt;				iostream				&gt;										#include 				&lt;				queue				&gt;																								using				 				namespace				 std;				#define				 N 100010	...&nbsp;&nbsp;<a href='http://www.cppblog.com/Darren/archive/2009/08/02/91977.html'>阅读全文</a><img src ="http://www.cppblog.com/Darren/aggbug/91977.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Darren/" target="_blank">Darren</a> 2009-08-02 22:05 <a href="http://www.cppblog.com/Darren/archive/2009/08/02/91977.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Pku   3169  Layout</title><link>http://www.cppblog.com/Darren/archive/2009/07/20/90649.html</link><dc:creator>Darren</dc:creator><author>Darren</author><pubDate>Mon, 20 Jul 2009 11:55:00 GMT</pubDate><guid>http://www.cppblog.com/Darren/archive/2009/07/20/90649.html</guid><wfw:comment>http://www.cppblog.com/Darren/comments/90649.html</wfw:comment><comments>http://www.cppblog.com/Darren/archive/2009/07/20/90649.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Darren/comments/commentRss/90649.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Darren/services/trackbacks/90649.html</trackback:ping><description><![CDATA[
		<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
				<span style="COLOR: #000000">#include </span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #000000">stdio.h</span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000">
						<br />#include </span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #000000">stdlib.h</span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000">
						<br />#include </span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #0000ff">string</span>
				<span style="COLOR: #000000">.h</span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000">
						<br />
						<br />
				</span>
				<span style="COLOR: #0000ff">#define</span>
				<span style="COLOR: #000000"> N 1005</span>
				<span style="COLOR: #000000">
						<br />
				</span>
				<span style="COLOR: #0000ff">#define</span>
				<span style="COLOR: #000000"> inf 1&lt;&lt;29</span>
				<span style="COLOR: #000000">
						<br />
						<br />
				</span>
				<span style="COLOR: #0000ff">struct</span>
				<span style="COLOR: #000000"> Edge{<br />    </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> u, v, d;<br />    Edge( </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> a</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">, </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> b</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">, </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> c</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000"> ):<br />        u(a), v(b), d(c) {}<br />};<br /><br /></span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> n, ml, md, s</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">;<br />Edge  ege[</span>
				<span style="COLOR: #000000">20010</span>
				<span style="COLOR: #000000">];<br /></span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> dist[N];<br /><br /></span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> bell_man(){<br />    </span>
				<span style="COLOR: #0000ff">for</span>
				<span style="COLOR: #000000">( </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> i</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">1</span>
				<span style="COLOR: #000000">; i</span>
				<span style="COLOR: #000000">&lt;=</span>
				<span style="COLOR: #000000"> n; </span>
				<span style="COLOR: #000000">++</span>
				<span style="COLOR: #000000">i ) dist[i]</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> inf;<br />    dist[</span>
				<span style="COLOR: #000000">1</span>
				<span style="COLOR: #000000">]</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">;<br />    <br />    </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> flag</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">;<br />    </span>
				<span style="COLOR: #0000ff">for</span>
				<span style="COLOR: #000000">( </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> i</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">1</span>
				<span style="COLOR: #000000">; i</span>
				<span style="COLOR: #000000">&lt;=</span>
				<span style="COLOR: #000000"> n; </span>
				<span style="COLOR: #000000">++</span>
				<span style="COLOR: #000000">i ){<br />        flag</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">;<br />        </span>
				<span style="COLOR: #0000ff">for</span>
				<span style="COLOR: #000000">( </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> j</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">; j</span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #000000"> s; </span>
				<span style="COLOR: #000000">++</span>
				<span style="COLOR: #000000">j ){<br />            </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> u</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> ege[j].u, v</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> ege[j].v, w</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> ege[j].d;<br />            </span>
				<span style="COLOR: #0000ff">if</span>
				<span style="COLOR: #000000">( dist[u]</span>
				<span style="COLOR: #000000">+</span>
				<span style="COLOR: #000000"> w</span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #000000"> dist[v] ) dist[v]</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> dist[u]</span>
				<span style="COLOR: #000000">+</span>
				<span style="COLOR: #000000"> w, flag</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">1</span>
				<span style="COLOR: #000000">;<br />        }<br />        </span>
				<span style="COLOR: #0000ff">if</span>
				<span style="COLOR: #000000">( </span>
				<span style="COLOR: #000000">!</span>
				<span style="COLOR: #000000">flag ) </span>
				<span style="COLOR: #0000ff">break</span>
				<span style="COLOR: #000000">;<br />    }<br />    </span>
				<span style="COLOR: #0000ff">if</span>
				<span style="COLOR: #000000">( flag ) </span>
				<span style="COLOR: #0000ff">return</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">1</span>
				<span style="COLOR: #000000">;<br />    </span>
				<span style="COLOR: #0000ff">else</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #0000ff">if</span>
				<span style="COLOR: #000000">( dist[n]</span>
				<span style="COLOR: #000000">==</span>
				<span style="COLOR: #000000"> inf ) </span>
				<span style="COLOR: #0000ff">return</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">2</span>
				<span style="COLOR: #000000">;<br />    </span>
				<span style="COLOR: #0000ff">else</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #0000ff">return</span>
				<span style="COLOR: #000000"> dist[n];<br />}<br /><br /></span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> main(){<br />    scanf(</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">%d%d%d</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">,</span>
				<span style="COLOR: #000000">&amp;</span>
				<span style="COLOR: #000000">n,</span>
				<span style="COLOR: #000000">&amp;</span>
				<span style="COLOR: #000000">ml,</span>
				<span style="COLOR: #000000">&amp;</span>
				<span style="COLOR: #000000">md );<br />    </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> u, v, d;<br />    </span>
				<span style="COLOR: #0000ff">while</span>
				<span style="COLOR: #000000">( ml</span>
				<span style="COLOR: #000000">--</span>
				<span style="COLOR: #000000"> ){<br />        scanf(</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">%d%d%d</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">,</span>
				<span style="COLOR: #000000">&amp;</span>
				<span style="COLOR: #000000">u,</span>
				<span style="COLOR: #000000">&amp;</span>
				<span style="COLOR: #000000">v,</span>
				<span style="COLOR: #000000">&amp;</span>
				<span style="COLOR: #000000">d );<br />        ege[s</span>
				<span style="COLOR: #000000">++</span>
				<span style="COLOR: #000000">]</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> Edge( u, v, d );<br />    }<br />    </span>
				<span style="COLOR: #0000ff">while</span>
				<span style="COLOR: #000000">( md</span>
				<span style="COLOR: #000000">--</span>
				<span style="COLOR: #000000"> ){<br />        scanf(</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">%d%d%d</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">,</span>
				<span style="COLOR: #000000">&amp;</span>
				<span style="COLOR: #000000">u,</span>
				<span style="COLOR: #000000">&amp;</span>
				<span style="COLOR: #000000">v,</span>
				<span style="COLOR: #000000">&amp;</span>
				<span style="COLOR: #000000">d );<br />        ege[s</span>
				<span style="COLOR: #000000">++</span>
				<span style="COLOR: #000000">]</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> Edge( v, u, </span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">d );<br />    }<br />    printf(</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">%d\n</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">, bell_man() );<br /><br />    </span>
				<span style="COLOR: #0000ff">return</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">;<br />}<br /></span>
		</div>
<img src ="http://www.cppblog.com/Darren/aggbug/90649.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Darren/" target="_blank">Darren</a> 2009-07-20 19:55 <a href="http://www.cppblog.com/Darren/archive/2009/07/20/90649.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Pku  1986  Distance Queries</title><link>http://www.cppblog.com/Darren/archive/2009/07/20/90590.html</link><dc:creator>Darren</dc:creator><author>Darren</author><pubDate>Mon, 20 Jul 2009 02:56:00 GMT</pubDate><guid>http://www.cppblog.com/Darren/archive/2009/07/20/90590.html</guid><wfw:comment>http://www.cppblog.com/Darren/comments/90590.html</wfw:comment><comments>http://www.cppblog.com/Darren/archive/2009/07/20/90590.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Darren/comments/commentRss/90590.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Darren/services/trackbacks/90590.html</trackback:ping><description><![CDATA[
		<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
				<span style="COLOR: #000000">#include </span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #000000">iostream</span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000">
						<br />#include </span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #000000">vector</span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000">
						<br />
						<br />
				</span>
				<span style="COLOR: #0000ff">using</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #0000ff">namespace</span>
				<span style="COLOR: #000000"> std;<br /><br /></span>
				<span style="COLOR: #0000ff">#define</span>
				<span style="COLOR: #000000"> N 40010</span>
				<span style="COLOR: #000000">
						<br />typedef pair</span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000">,</span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000"> PAIR;<br /><br /></span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> m, n;<br />vector</span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #000000">PAIR</span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000"> query[N], map[N];<br /><br /></span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> uset[N]</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> {</span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">}, acs[N], flag[N]</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> {</span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">}, dis[N]</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> {</span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">}, ans[N], visite[N]</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000">{</span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">};<br /><br /></span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> find( </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> x ){<br />    </span>
				<span style="COLOR: #0000ff">while</span>
				<span style="COLOR: #000000">( x</span>
				<span style="COLOR: #000000">!=</span>
				<span style="COLOR: #000000"> uset[x] ) x</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> uset[x];<br />    </span>
				<span style="COLOR: #0000ff">return</span>
				<span style="COLOR: #000000"> x; }<br /><br /></span>
				<span style="COLOR: #0000ff">void</span>
				<span style="COLOR: #000000"> join( </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> x, </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> y ){  uset[ find(x) ]</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> uset[ find(y) ]; }<br /><br /></span>
				<span style="COLOR: #0000ff">void</span>
				<span style="COLOR: #000000"> dfs( </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> u, </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> d ){<br />    uset[u]</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> u; acs[u]</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> u; dis[u]</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> d; visite[u]</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">1</span>
				<span style="COLOR: #000000">;<br />    </span>
				<span style="COLOR: #0000ff">for</span>
				<span style="COLOR: #000000">( size_t i</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">; i</span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #000000"> map[u].size(); </span>
				<span style="COLOR: #000000">++</span>
				<span style="COLOR: #000000">i ){<br />        </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> v</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> map[u][i].first, w</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> map[u][i].second;<br />        </span>
				<span style="COLOR: #0000ff">if</span>
				<span style="COLOR: #000000">( </span>
				<span style="COLOR: #000000">!</span>
				<span style="COLOR: #000000">visite[v] ){<br />            dfs( v, d</span>
				<span style="COLOR: #000000">+</span>
				<span style="COLOR: #000000"> w );<br />            join( u, v ); acs[ find(u) ]</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> u;  }<br />    }<br />    <br />    flag[u]</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">1</span>
				<span style="COLOR: #000000">;<br />    </span>
				<span style="COLOR: #0000ff">for</span>
				<span style="COLOR: #000000">( size_t i</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">; i</span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #000000"> query[u].size(); </span>
				<span style="COLOR: #000000">++</span>
				<span style="COLOR: #000000">i ){<br />        </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> v</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> query[u][i].first, w</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> query[u][i].second;<br />        <br />        </span>
				<span style="COLOR: #0000ff">if</span>
				<span style="COLOR: #000000">( flag[v] ) ans[w]</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> dis[u]</span>
				<span style="COLOR: #000000">+</span>
				<span style="COLOR: #000000"> dis[v]</span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">2</span>
				<span style="COLOR: #000000">*</span>
				<span style="COLOR: #000000"> dis[ acs[ find(v) ] ];<br />    }    <br />}<br /><br /></span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> main(){<br />    </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> u, v, d;<br />    </span>
				<span style="COLOR: #0000ff">char</span>
				<span style="COLOR: #000000"> s[</span>
				<span style="COLOR: #000000">10</span>
				<span style="COLOR: #000000">];<br />    <br />    scanf(</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">%d%d</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">,</span>
				<span style="COLOR: #000000">&amp;</span>
				<span style="COLOR: #000000">n,</span>
				<span style="COLOR: #000000">&amp;</span>
				<span style="COLOR: #000000">m);<br />    </span>
				<span style="COLOR: #0000ff">while</span>
				<span style="COLOR: #000000">( m</span>
				<span style="COLOR: #000000">--</span>
				<span style="COLOR: #000000"> ){<br />        scanf(</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">%d%d%d%s</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">,</span>
				<span style="COLOR: #000000">&amp;</span>
				<span style="COLOR: #000000">u,</span>
				<span style="COLOR: #000000">&amp;</span>
				<span style="COLOR: #000000">v,</span>
				<span style="COLOR: #000000">&amp;</span>
				<span style="COLOR: #000000">d,s );<br />        map[u].push_back( PAIR(v,d) );<br />        map[v].push_back( PAIR(u,d) );<br />    }<br />    <br />    scanf(</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">%d</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">,</span>
				<span style="COLOR: #000000">&amp;</span>
				<span style="COLOR: #000000">m );<br />    </span>
				<span style="COLOR: #0000ff">for</span>
				<span style="COLOR: #000000">( </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> i</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">1</span>
				<span style="COLOR: #000000">; i</span>
				<span style="COLOR: #000000">&lt;=</span>
				<span style="COLOR: #000000"> m; </span>
				<span style="COLOR: #000000">++</span>
				<span style="COLOR: #000000">i ){<br />        scanf(</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">%d%d</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">,</span>
				<span style="COLOR: #000000">&amp;</span>
				<span style="COLOR: #000000">u,</span>
				<span style="COLOR: #000000">&amp;</span>
				<span style="COLOR: #000000">v );<br />        query[u].push_back( PAIR(v,i) );<br />        query[v].push_back( PAIR(u,i) );<br />    }<br />    memset( flag, </span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">, </span>
				<span style="COLOR: #0000ff">sizeof</span>
				<span style="COLOR: #000000">(flag) );<br />    memset( visite, </span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">, </span>
				<span style="COLOR: #0000ff">sizeof</span>
				<span style="COLOR: #000000">(visite) );<br />    <br />    dfs( </span>
				<span style="COLOR: #000000">1</span>
				<span style="COLOR: #000000">, </span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000"> ); <br />    </span>
				<span style="COLOR: #0000ff">for</span>
				<span style="COLOR: #000000">( </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> i</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">1</span>
				<span style="COLOR: #000000">; i</span>
				<span style="COLOR: #000000">&lt;=</span>
				<span style="COLOR: #000000"> m; </span>
				<span style="COLOR: #000000">++</span>
				<span style="COLOR: #000000">i ) printf(</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">%d\n</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">, ans[i] );<br />    <br />    </span>
				<span style="COLOR: #0000ff">return</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">;<br />}<br /></span>
		</div>
<img src ="http://www.cppblog.com/Darren/aggbug/90590.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Darren/" target="_blank">Darren</a> 2009-07-20 10:56 <a href="http://www.cppblog.com/Darren/archive/2009/07/20/90590.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Pku  1276  Cash Machine</title><link>http://www.cppblog.com/Darren/archive/2009/07/19/90518.html</link><dc:creator>Darren</dc:creator><author>Darren</author><pubDate>Sun, 19 Jul 2009 05:44:00 GMT</pubDate><guid>http://www.cppblog.com/Darren/archive/2009/07/19/90518.html</guid><wfw:comment>http://www.cppblog.com/Darren/comments/90518.html</wfw:comment><comments>http://www.cppblog.com/Darren/archive/2009/07/19/90518.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cppblog.com/Darren/comments/commentRss/90518.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Darren/services/trackbacks/90518.html</trackback:ping><description><![CDATA[
		<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
				<span style="COLOR: #000000">#include </span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #000000">iostream</span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000">
						<br />
						<br />
				</span>
				<span style="COLOR: #0000ff">using</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #0000ff">namespace</span>
				<span style="COLOR: #000000"> std;<br /><br /></span>
				<span style="COLOR: #0000ff">#define</span>
				<span style="COLOR: #000000"> N 100001</span>
				<span style="COLOR: #000000">
						<br />
						<br />
				</span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> nk[</span>
				<span style="COLOR: #000000">11</span>
				<span style="COLOR: #000000">], dk[</span>
				<span style="COLOR: #000000">11</span>
				<span style="COLOR: #000000">], n, m, ans[N], num[N];<br /><br /></span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> main(){<br />    </span>
				<span style="COLOR: #0000ff">while</span>
				<span style="COLOR: #000000">( scanf(</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">%d%d</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">,</span>
				<span style="COLOR: #000000">&amp;</span>
				<span style="COLOR: #000000">m,</span>
				<span style="COLOR: #000000">&amp;</span>
				<span style="COLOR: #000000">n )</span>
				<span style="COLOR: #000000">!=</span>
				<span style="COLOR: #000000"> EOF ){<br />        </span>
				<span style="COLOR: #0000ff">for</span>
				<span style="COLOR: #000000">( </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> i</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">; i</span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #000000"> n; </span>
				<span style="COLOR: #000000">++</span>
				<span style="COLOR: #000000">i ) scanf(</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">%d%d</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">, nk</span>
				<span style="COLOR: #000000">+</span>
				<span style="COLOR: #000000"> i, dk</span>
				<span style="COLOR: #000000">+</span>
				<span style="COLOR: #000000"> i );<br />        </span>
				<span style="COLOR: #0000ff">for</span>
				<span style="COLOR: #000000">( </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> i</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">; i</span>
				<span style="COLOR: #000000">&lt;=</span>
				<span style="COLOR: #000000"> m; </span>
				<span style="COLOR: #000000">++</span>
				<span style="COLOR: #000000">i ) ans[i]</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">; ans[</span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">]</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">1</span>
				<span style="COLOR: #000000">;<br />        <br />        </span>
				<span style="COLOR: #0000ff">for</span>
				<span style="COLOR: #000000">( </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> i</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">; i</span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #000000"> n; </span>
				<span style="COLOR: #000000">++</span>
				<span style="COLOR: #000000">i ){<br />            </span>
				<span style="COLOR: #0000ff">for</span>
				<span style="COLOR: #000000">( </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> j</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">; j</span>
				<span style="COLOR: #000000">&lt;=</span>
				<span style="COLOR: #000000"> m; </span>
				<span style="COLOR: #000000">++</span>
				<span style="COLOR: #000000">j ) num[j]</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">;<br />            <br />            </span>
				<span style="COLOR: #0000ff">for</span>
				<span style="COLOR: #000000">( </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> j</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> dk[i]; j</span>
				<span style="COLOR: #000000">&lt;=</span>
				<span style="COLOR: #000000"> m; </span>
				<span style="COLOR: #000000">++</span>
				<span style="COLOR: #000000">j )<br />            </span>
				<span style="COLOR: #0000ff">if</span>
				<span style="COLOR: #000000">( </span>
				<span style="COLOR: #000000">!</span>
				<span style="COLOR: #000000"> ans[j] </span>
				<span style="COLOR: #000000">&amp;&amp;</span>
				<span style="COLOR: #000000"> ans[j</span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">dk[i]] </span>
				<span style="COLOR: #000000">&amp;&amp;</span>
				<span style="COLOR: #000000"> num[j</span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000"> dk[i]]</span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #000000"> nk[i] ){<br />                num[j]</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> num[j</span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">dk[i]]</span>
				<span style="COLOR: #000000">+</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">1</span>
				<span style="COLOR: #000000">;<br />                ans[j]</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">1</span>
				<span style="COLOR: #000000">; }<br />        }<br />        <br />        </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> res</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> m;<br />        </span>
				<span style="COLOR: #0000ff">while</span>
				<span style="COLOR: #000000">( ans[res]</span>
				<span style="COLOR: #000000">==</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">&amp;&amp;</span>
				<span style="COLOR: #000000"> res</span>
				<span style="COLOR: #000000">&gt;=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">1</span>
				<span style="COLOR: #000000"> ) res</span>
				<span style="COLOR: #000000">--</span>
				<span style="COLOR: #000000">;<br />        printf(</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">%d\n</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">, res );<br />    }<br />    <br />    </span>
				<span style="COLOR: #0000ff">return</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">;<br />}<br /></span>
		</div>
<img src ="http://www.cppblog.com/Darren/aggbug/90518.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Darren/" target="_blank">Darren</a> 2009-07-19 13:44 <a href="http://www.cppblog.com/Darren/archive/2009/07/19/90518.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>