<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments for Greenmoon55's Blog</title>
	<atom:link href="http://greenmoon55.com/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://greenmoon55.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Mon, 14 May 2012 11:09:12 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>Comment on 火场逃生记 by Greenmoon55</title>
		<link>http://greenmoon55.com/escaped-from-a-fire/comment-page-1/#comment-5049</link>
		<dc:creator>Greenmoon55</dc:creator>
		<pubDate>Mon, 14 May 2012 11:09:12 +0000</pubDate>
		<guid isPermaLink="false">http://greenmoon55.com/?p=216#comment-5049</guid>
		<description>你从随机文章里看到的吧...
好像当时很淡定，消防车走了我又回来玩游戏了...</description>
		<content:encoded><![CDATA[<p>你从随机文章里看到的吧&#8230;<br />
好像当时很淡定，消防车走了我又回来玩游戏了&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on 火场逃生记 by EUYUIL</title>
		<link>http://greenmoon55.com/escaped-from-a-fire/comment-page-1/#comment-5027</link>
		<dc:creator>EUYUIL</dc:creator>
		<pubDate>Sun, 13 May 2012 13:42:20 +0000</pubDate>
		<guid isPermaLink="false">http://greenmoon55.com/?p=216#comment-5027</guid>
		<description>惊险啊。我从来没有经历过火灾……</description>
		<content:encoded><![CDATA[<p>惊险啊。我从来没有经历过火灾……</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Google Code Jam 2012 by EUYUIL</title>
		<link>http://greenmoon55.com/google-code-jam-2012/comment-page-1/#comment-5026</link>
		<dc:creator>EUYUIL</dc:creator>
		<pubDate>Sun, 13 May 2012 13:40:05 +0000</pubDate>
		<guid isPermaLink="false">http://greenmoon55.com/?p=366#comment-5026</guid>
		<description>我无脑地参加了第一场，跪了。去金华也没时间参加后两场……</description>
		<content:encoded><![CDATA[<p>我无脑地参加了第一场，跪了。去金华也没时间参加后两场……</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on HDU3682 To Be an Dream Architect by ACM/ICPC 2010 杭州现场赛 To Be a Dream Architect 题解 &#8249; EUYUIL</title>
		<link>http://greenmoon55.com/hdu3682-to-be-an-dream-architect/comment-page-1/#comment-4950</link>
		<dc:creator>ACM/ICPC 2010 杭州现场赛 To Be a Dream Architect 题解 &#8249; EUYUIL</dc:creator>
		<pubDate>Thu, 10 May 2012 07:43:50 +0000</pubDate>
		<guid isPermaLink="false">http://greenmoon55.com/?p=338#comment-4950</guid>
		<description>[...] jQuery(document).ready(function($){ if (navigator.platform == &quot;iPad&quot;) return; jQuery(&quot;img&quot;).not(&quot;.cycle img&quot;).lazyload({ effect:&quot;fadeIn&quot;, placeholder: &quot;http://euyuil.com/wp-content/plugins/jquery-image-lazy-loading/images/grey.gif&quot; }); }); MathJax.Hub.Config({ extensions: [&quot;tex2jax.js&quot;], jax: [&quot;input/TeX&quot;, &quot;output/HTML-CSS&quot;], tex2jax: { inlineMath: [ [&#039;$&#039;,&#039;$&#039;], [&quot;\(&quot;,&quot;\)&quot;], [&quot;[latex]&quot;,&quot;[/latex]&quot;] ], displayMath: [ [&#039;$$&#039;,&#039;$$&#039;], [&quot;\[&quot;,&quot;\]&quot;] ], processEscapes: true }, &quot;HTML-CSS&quot;: { availableFonts: [&quot;TeX&quot;] } });  LiuyueICPC SolutionsSoftware OpusGuestbookSearchAboutACM/ICPC 2010 杭州现场赛 To Be a Dream Architect 题解2012-02-15 21:17:18 &#8226; ICPC, 区域赛, 现场赛, 空间几何, 题解 &#8226; 已有 2 条评论 google_ad_client = &quot;ca-pub-7808863410544596&quot;; /* EUYUIL.COM 文章内容中 */ google_ad_slot = &quot;7087084322&quot;; google_ad_width = 300; google_ad_height = 250;  这道题的题意是给出一个 N × N 的正方体，这个正方体是由 1 × 1 的小正方体垒成的。然后，输入数据会给出若干个命令，这些命令都表示一条平行于某坐标轴的直线，命令的效果是让这个直线上的所有方块消失掉。最后，问消失了多少小方块。似乎这道题原题标题犯了个小小的语法错误……关于这道题的解法，Greenmoon55 说，可以用 vector + sort + unique 系列的方法解决这个问题，还提到 set 可能会超时超内存[GRN&#039;11]。我想原因是插入删除过程其实是 O(logn) 的，并且使用动态内存分配频繁，各种冗余数据比较多吧。这种方法的时间复杂度是 O(n2logn).我的解法是另一种，我使用一个数组 planes[3][N][N], 记录输入的每一条直线。在每执行一条直线的命令的时候，判断某一个方块是否已经被其它直线去掉了。所以这就降了一维，复杂度是 O(n2). 但是现场赛时，我可能会采取 Greenmoon55 的做法。源代码123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657#include &lt;cstdio&gt; #include &lt;cstring&gt; using namespace std;const int N = 1001;bool planes[3][N][N];int n, m;inline bool is_coord_valid(int x, int y){&#160;&#160;&#160;&#160;if (x &gt;= 1 &amp;&amp; x &lt;= n &amp;&amp; y &gt;= 0 &amp;&amp; y &lt;= n)&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return true;&#160;&#160;&#160;&#160;return false;}inline int count_cubes(int i0, int x, int y){&#160;&#160;&#160;&#160;int i1 = (i0 + 1) % 3, i2 = (i0 + 2) % 3;&#160;&#160;&#160;&#160;if (planes[i0][x][y])&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return 0; // Already counted. &#160;&#160;&#160;&#160;planes[i0][x][y] = true;&#160;&#160;&#160;&#160;int result = 0;&#160;&#160;&#160;&#160;for (int z = 1; z &lt;= n; ++z)&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if (!planes[i1][y][z] &amp;&amp; !planes[i2][z][x])&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;++result;&#160;&#160;&#160;&#160;return result;}int main(){&#160;&#160;&#160;&#160;int T, x, y, r; char a, b, buf[32];&#160;&#160;&#160;&#160;scanf(&quot;%d&quot;, &amp;T);&#160;&#160;&#160;&#160;while (T--)&#160;&#160;&#160;&#160;{&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf(&quot;%d %d&quot;, &amp;n, &amp;m); r = 0;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;memset(planes, false, sizeof planes);&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for (int i = 0; i &lt; m; ++i)&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;{&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;gets(buf); // Skip EOLN. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf(&quot;%c=%d,%c=%d&quot;, &amp;a, &amp;x, &amp;b, &amp;y);&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if (a == &#039;X&#039; &amp;&amp; b == &#039;Y&#039;) r += count_cubes(0, x, y);&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;else if (a == &#039;Y&#039; &amp;&amp; b == &#039;X&#039;) r += count_cubes(0, y, x);&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;else if (a == &#039;Y&#039; &amp;&amp; b == &#039;Z&#039;) r += count_cubes(1, x, y);&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;else if (a == &#039;Z&#039; &amp;&amp; b == &#039;Y&#039;) r += count_cubes(1, y, x);&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;else if (a == &#039;Z&#039; &amp;&amp; b == &#039;X&#039;) r += count_cubes(2, x, y);&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;else if (a == &#039;X&#039; &amp;&amp; b == &#039;Z&#039;) r += count_cubes(2, y, x);&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;printf(&quot;%dn&quot;, r);&#160;&#160;&#160;&#160;}&#160;&#160;&#160;&#160;return 0;}参考[GRN&#039;11] Greenmoon55:《HDU3682 To Be an Dream Architect》原创文章，转载请注明来源：http://euyuil.com/3250/acm-icpc-2010-hangzhou-to-be-a-dream-architect/  搜索框载入中……  google.load(&#039;search&#039;, &#039;1&#039;, {language : &#039;zh-CN&#039;}); google.setOnLoadCallback(function() { var customSearchControl = new google.search.CustomSearchControl(&#039;001309449942216446108:hg0oww9xcq0&#039;); customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET); var options = new google.search.DrawOptions(); options.setAutoComplete(true); options.enableSearchboxOnly(&quot;http://euyuil.com/search/&quot;, &quot;keyword&quot;); customSearchControl.draw(&#039;cse-search-form&#039;, options); }, true); [...]</description>
		<content:encoded><![CDATA[<p>[...] jQuery(document).ready(function($){ if (navigator.platform == &quot;iPad&quot;) return; jQuery(&quot;img&quot;).not(&quot;.cycle img&quot;).lazyload({ effect:&quot;fadeIn&quot;, placeholder: &quot;<a href="http://euyuil.com/wp-content/plugins/jquery-image-lazy-loading/images/grey.gif&#038;quot" rel="nofollow">http://euyuil.com/wp-content/plugins/jquery-image-lazy-loading/images/grey.gif&#038;quot</a>; }); }); MathJax.Hub.Config({ extensions: [&quot;tex2jax.js&quot;], jax: [&quot;input/TeX&quot;, &quot;output/HTML-CSS&quot;], tex2jax: { inlineMath: [ [&#039;$&#039;,&#039;$&#039;], [&quot;\(&quot;,&quot;\)&quot;], [&quot;[latex]&quot;,&quot;[/latex]&quot;] ], displayMath: [ [&#039;$$&#039;,&#039;$$&#039;], [&quot;\[&quot;,&quot;\]&quot;] ], processEscapes: true }, &quot;HTML-CSS&quot;: { availableFonts: [&quot;TeX&quot;] } });  LiuyueICPC SolutionsSoftware OpusGuestbookSearchAboutACM/ICPC 2010 杭州现场赛 To Be a Dream Architect 题解2012-02-15 21:17:18 &bull; ICPC, 区域赛, 现场赛, 空间几何, 题解 &bull; 已有 2 条评论 google_ad_client = &quot;ca-pub-7808863410544596&quot;; /* EUYUIL.COM 文章内容中 */ google_ad_slot = &quot;7087084322&quot;; google_ad_width = 300; google_ad_height = 250;  这道题的题意是给出一个 N × N 的正方体，这个正方体是由 1 × 1 的小正方体垒成的。然后，输入数据会给出若干个命令，这些命令都表示一条平行于某坐标轴的直线，命令的效果是让这个直线上的所有方块消失掉。最后，问消失了多少小方块。似乎这道题原题标题犯了个小小的语法错误……关于这道题的解法，Greenmoon55 说，可以用 vector + sort + unique 系列的方法解决这个问题，还提到 set 可能会超时超内存[GRN&#039;11]。我想原因是插入删除过程其实是 O(logn) 的，并且使用动态内存分配频繁，各种冗余数据比较多吧。这种方法的时间复杂度是 O(n2logn).我的解法是另一种，我使用一个数组 planes[3][N][N], 记录输入的每一条直线。在每执行一条直线的命令的时候，判断某一个方块是否已经被其它直线去掉了。所以这就降了一维，复杂度是 O(n2). 但是现场赛时，我可能会采取 Greenmoon55 的做法。源代码123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657#include &lt;cstdio&gt; #include &lt;cstring&gt; using namespace std;const int N = 1001;bool planes[3][N][N];int n, m;inline bool is_coord_valid(int x, int y){&nbsp;&nbsp;&nbsp;&nbsp;if (x &gt;= 1 &amp;&amp; x &lt;= n &amp;&amp; y &gt;= 0 &amp;&amp; y &lt;= n)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return true;&nbsp;&nbsp;&nbsp;&nbsp;return false;}inline int count_cubes(int i0, int x, int y){&nbsp;&nbsp;&nbsp;&nbsp;int i1 = (i0 + 1) % 3, i2 = (i0 + 2) % 3;&nbsp;&nbsp;&nbsp;&nbsp;if (planes[i0][x][y])&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return 0; // Already counted. &nbsp;&nbsp;&nbsp;&nbsp;planes[i0][x][y] = true;&nbsp;&nbsp;&nbsp;&nbsp;int result = 0;&nbsp;&nbsp;&nbsp;&nbsp;for (int z = 1; z &lt;= n; ++z)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (!planes[i1][y][z] &amp;&amp; !planes[i2][z][x])&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;++result;&nbsp;&nbsp;&nbsp;&nbsp;return result;}int main(){&nbsp;&nbsp;&nbsp;&nbsp;int T, x, y, r; char a, b, buf[32];&nbsp;&nbsp;&nbsp;&nbsp;scanf(&quot;%d&quot;, &amp;T);&nbsp;&nbsp;&nbsp;&nbsp;while (T&#8211;)&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;scanf(&quot;%d %d&quot;, &amp;n, &amp;m); r = 0;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;memset(planes, false, sizeof planes);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (int i = 0; i &lt; m; ++i)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;gets(buf); // Skip EOLN. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;scanf(&quot;%c=%d,%c=%d&quot;, &amp;a, &amp;x, &amp;b, &amp;y);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (a == &#039;X&#039; &amp;&amp; b == &#039;Y&#039;) r += count_cubes(0, x, y);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else if (a == &#039;Y&#039; &amp;&amp; b == &#039;X&#039;) r += count_cubes(0, y, x);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else if (a == &#039;Y&#039; &amp;&amp; b == &#039;Z&#039;) r += count_cubes(1, x, y);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else if (a == &#039;Z&#039; &amp;&amp; b == &#039;Y&#039;) r += count_cubes(1, y, x);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else if (a == &#039;Z&#039; &amp;&amp; b == &#039;X&#039;) r += count_cubes(2, x, y);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else if (a == &#039;X&#039; &amp;&amp; b == &#039;Z&#039;) r += count_cubes(2, y, x);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printf(&quot;%dn&quot;, r);&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;return 0;}参考[GRN&#039;11] Greenmoon55:《HDU3682 To Be an Dream Architect》原创文章，转载请注明来源：http://euyuil.com/3250/acm-icpc-2010-hangzhou-to-be-a-dream-architect/  搜索框载入中……  google.load(&#039;search&#039;, &#039;1&#039;, {language : &#039;zh-CN&#039;}); google.setOnLoadCallback(function() { var customSearchControl = new google.search.CustomSearchControl(&#039;001309449942216446108:hg0oww9xcq0&#039;); customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET); var options = new google.search.DrawOptions(); options.setAutoComplete(true); options.enableSearchboxOnly(&quot;<a href="http://euyuil.com/search/&#038;quot" rel="nofollow">http://euyuil.com/search/&#038;quot</a>;, &quot;keyword&quot;); customSearchControl.draw(&#039;cse-search-form&#039;, options); }, true); [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on HDU3682 To Be an Dream Architect by EUYUIL</title>
		<link>http://greenmoon55.com/hdu3682-to-be-an-dream-architect/comment-page-1/#comment-4338</link>
		<dc:creator>EUYUIL</dc:creator>
		<pubDate>Wed, 15 Feb 2012 06:41:24 +0000</pubDate>
		<guid isPermaLink="false">http://greenmoon55.com/?p=338#comment-4338</guid>
		<description>这种解法真牛逼。</description>
		<content:encoded><![CDATA[<p>这种解法真牛逼。</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on HDU3687 National Day Parade by ACM/ICPC 2010 杭州现场赛 National Day Parade 题解 &#8249; EUYUIL</title>
		<link>http://greenmoon55.com/hdu3687-national-day-parade/comment-page-1/#comment-4337</link>
		<dc:creator>ACM/ICPC 2010 杭州现场赛 National Day Parade 题解 &#8249; EUYUIL</dc:creator>
		<pubDate>Wed, 15 Feb 2012 06:32:03 +0000</pubDate>
		<guid isPermaLink="false">http://greenmoon55.com/?p=339#comment-4337</guid>
		<description>[...] jQuery(document).ready(function($){ if (navigator.platform == &quot;iPad&quot;) return; jQuery(&quot;img&quot;).not(&quot;.cycle img&quot;).lazyload({ effect:&quot;fadeIn&quot;, placeholder: &quot;http://euyuil.com/wp-content/plugins/jquery-image-lazy-loading/images/grey.gif&quot; }); }); MathJax.Hub.Config({ extensions: [&quot;tex2jax.js&quot;], jax: [&quot;input/TeX&quot;, &quot;output/HTML-CSS&quot;], tex2jax: { inlineMath: [ [&#039;$&#039;,&#039;$&#039;], [&quot;\(&quot;,&quot;\)&quot;], [&quot;[latex]&quot;,&quot;[/latex]&quot;] ], displayMath: [ [&#039;$$&#039;,&#039;$$&#039;], [&quot;\[&quot;,&quot;\]&quot;] ], processEscapes: true }, &quot;HTML-CSS&quot;: { availableFonts: [&quot;TeX&quot;] } });  LiuyueACM SolutionsSoftware OpusGuestbookSearchAboutACM/ICPC 2010 杭州现场赛 National Day Parade 题解2012-02-15 14:44:19 &#8226; ACM, 区域赛, 水题, 现场赛, 题解 &#8226; 抢沙发这是在 Greenmoon55&#8242;s Blog 挖掘出来的水题一则。果断凑数。思路是把每行的学生的列坐标分别排序，枚举左边一列的列号即可。代码如下：#crayon-4f3b544841637 .crayon-plain { font-size: 12px !important; line-height: 16px !important;}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748#include &lt;cmath&gt; #include &lt;cstdio&gt; #include &lt;climits&gt; #include &lt;cstring&gt; #include &lt;iostream&gt; #include &lt;algorithm&gt; using namespace std;const int N = 222;int i2j[N][N], cnt[N], n, m, n2;int main(){&#160;&#160;&#160;&#160;// freopen(&quot;input.txt&quot;, &quot;r&quot;, stdin); &#160;&#160;&#160;&#160;while (cin &gt;&gt; n &gt;&gt; m)&#160;&#160;&#160;&#160;{&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if (n == 0 &amp;&amp; m == 0)&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;break;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;memset(cnt, 0, sizeof cnt);&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;n2 = n * n;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for (int i = 0; i &lt; n2; ++i)&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;{&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int k, a; cin &gt;&gt; k; --k;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;cin &gt;&gt; a; --a; i2j[k][cnt[k]++] = a;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for (int i = 0; i &lt; n; ++i)&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;sort(i2j[i], i2j[i] + n);&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int rmost = m - n, sum, result = INT_MAX;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for (int i = 0; i &lt;= rmost; ++i)&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;{&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;sum = 0;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for (int j = 0; j &lt; n; ++j)&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for (int k = 0; k &lt; n; ++k)&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;sum += abs(i2j[j][k] - (i + k));&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;result = min(result, sum);&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;cout &lt;&lt; result &lt;&lt; endl;&#160;&#160;&#160;&#160;}&#160;&#160;&#160;&#160;return 0;}原创文章，转载请注明来源：http://euyuil.com/3245/acm-icpc-2010-hangzhou-national-day-parade/  搜索框载入中……  google.load(&#039;search&#039;, &#039;1&#039;, {language : &#039;zh-CN&#039;}); google.setOnLoadCallback(function() { var customSearchControl = new google.search.CustomSearchControl(&#039;001309449942216446108:hg0oww9xcq0&#039;); customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET); var options = new google.search.DrawOptions(); options.setAutoComplete(true); options.enableSearchboxOnly(&quot;http://euyuil.com/search/&quot;, &quot;keyword&quot;); customSearchControl.draw(&#039;cse-search-form&#039;, options); }, true); [...]</description>
		<content:encoded><![CDATA[<p>[...] jQuery(document).ready(function($){ if (navigator.platform == &quot;iPad&quot;) return; jQuery(&quot;img&quot;).not(&quot;.cycle img&quot;).lazyload({ effect:&quot;fadeIn&quot;, placeholder: &quot;<a href="http://euyuil.com/wp-content/plugins/jquery-image-lazy-loading/images/grey.gif&#038;quot" rel="nofollow">http://euyuil.com/wp-content/plugins/jquery-image-lazy-loading/images/grey.gif&#038;quot</a>; }); }); MathJax.Hub.Config({ extensions: [&quot;tex2jax.js&quot;], jax: [&quot;input/TeX&quot;, &quot;output/HTML-CSS&quot;], tex2jax: { inlineMath: [ [&#039;$&#039;,&#039;$&#039;], [&quot;\(&quot;,&quot;\)&quot;], [&quot;[latex]&quot;,&quot;[/latex]&quot;] ], displayMath: [ [&#039;$$&#039;,&#039;$$&#039;], [&quot;\[&quot;,&quot;\]&quot;] ], processEscapes: true }, &quot;HTML-CSS&quot;: { availableFonts: [&quot;TeX&quot;] } });  LiuyueACM SolutionsSoftware OpusGuestbookSearchAboutACM/ICPC 2010 杭州现场赛 National Day Parade 题解2012-02-15 14:44:19 &bull; ACM, 区域赛, 水题, 现场赛, 题解 &bull; 抢沙发这是在 Greenmoon55&#8242;s Blog 挖掘出来的水题一则。果断凑数。思路是把每行的学生的列坐标分别排序，枚举左边一列的列号即可。代码如下：#crayon-4f3b544841637 .crayon-plain { font-size: 12px !important; line-height: 16px !important;}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748#include &lt;cmath&gt; #include &lt;cstdio&gt; #include &lt;climits&gt; #include &lt;cstring&gt; #include &lt;iostream&gt; #include &lt;algorithm&gt; using namespace std;const int N = 222;int i2j[N][N], cnt[N], n, m, n2;int main(){&nbsp;&nbsp;&nbsp;&nbsp;// freopen(&quot;input.txt&quot;, &quot;r&quot;, stdin); &nbsp;&nbsp;&nbsp;&nbsp;while (cin &gt;&gt; n &gt;&gt; m)&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (n == 0 &amp;&amp; m == 0)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;memset(cnt, 0, sizeof cnt);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;n2 = n * n;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (int i = 0; i &lt; n2; ++i)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;int k, a; cin &gt;&gt; k; &#8211;k;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cin &gt;&gt; a; &#8211;a; i2j[k][cnt[k]++] = a;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (int i = 0; i &lt; n; ++i)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sort(i2j[i], i2j[i] + n);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;int rmost = m &#8211; n, sum, result = INT_MAX;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (int i = 0; i &lt;= rmost; ++i)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sum = 0;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (int j = 0; j &lt; n; ++j)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (int k = 0; k &lt; n; ++k)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sum += abs(i2j[j][k] &#8211; (i + k));&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;result = min(result, sum);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cout &lt;&lt; result &lt;&lt; endl;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;return 0;}原创文章，转载请注明来源：http://euyuil.com/3245/acm-icpc-2010-hangzhou-national-day-parade/  搜索框载入中……  google.load(&#039;search&#039;, &#039;1&#039;, {language : &#039;zh-CN&#039;}); google.setOnLoadCallback(function() { var customSearchControl = new google.search.CustomSearchControl(&#039;001309449942216446108:hg0oww9xcq0&#039;); customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET); var options = new google.search.DrawOptions(); options.setAutoComplete(true); options.enableSearchboxOnly(&quot;<a href="http://euyuil.com/search/&#038;quot" rel="nofollow">http://euyuil.com/search/&#038;quot</a>;, &quot;keyword&quot;); customSearchControl.draw(&#039;cse-search-form&#039;, options); }, true); [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Guestbook by 纳米黑客</title>
		<link>http://greenmoon55.com/guestbook/comment-page-1/#comment-4327</link>
		<dc:creator>纳米黑客</dc:creator>
		<pubDate>Mon, 13 Feb 2012 03:50:44 +0000</pubDate>
		<guid isPermaLink="false">http://greenmoon55.com/?page_id=23#comment-4327</guid>
		<description>神牛来换链接</description>
		<content:encoded><![CDATA[<p>神牛来换链接</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on HDU4121 Xiangqi by EUYUIL</title>
		<link>http://greenmoon55.com/hdu4121-xiangqi/comment-page-1/#comment-4282</link>
		<dc:creator>EUYUIL</dc:creator>
		<pubDate>Mon, 06 Feb 2012 08:57:58 +0000</pubDate>
		<guid isPermaLink="false">http://greenmoon55.com/?p=332#comment-4282</guid>
		<description>共勉啊~！</description>
		<content:encoded><![CDATA[<p>共勉啊~！</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Guestbook by 包子剑客</title>
		<link>http://greenmoon55.com/guestbook/comment-page-1/#comment-4279</link>
		<dc:creator>包子剑客</dc:creator>
		<pubDate>Sun, 05 Feb 2012 15:05:27 +0000</pubDate>
		<guid isPermaLink="false">http://greenmoon55.com/?page_id=23#comment-4279</guid>
		<description>看我邮箱就知道了。。。。。。

这验证又来了。。。。。</description>
		<content:encoded><![CDATA[<p>看我邮箱就知道了。。。。。。</p>
<p>这验证又来了。。。。。</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Guestbook by Greenmoon55</title>
		<link>http://greenmoon55.com/guestbook/comment-page-1/#comment-4278</link>
		<dc:creator>Greenmoon55</dc:creator>
		<pubDate>Sun, 05 Feb 2012 15:04:14 +0000</pubDate>
		<guid isPermaLink="false">http://greenmoon55.com/?page_id=23#comment-4278</guid>
		<description>这个名字好熟悉呀～在好多地方见过好多次。。 
嗯，确实应该考虑换验证码了= =</description>
		<content:encoded><![CDATA[<p>这个名字好熟悉呀～在好多地方见过好多次。。<br />
嗯，确实应该考虑换验证码了= =</p>
]]></content:encoded>
	</item>
</channel>
</rss>

