<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>某岛</title>
	<atom:link href="http://www.shuizilong.com/house/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.shuizilong.com/house</link>
	<description>... : &#34;... sister ftiasch is watching you .. .. . &#34; .. .</description>
	<lastBuildDate>Wed, 16 May 2012 11:25:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>&#8230; Test .. )</title>
		<link>http://www.shuizilong.com/house/archives/test-2/</link>
		<comments>http://www.shuizilong.com/house/archives/test-2/#comments</comments>
		<pubDate>Wed, 16 May 2012 11:25:22 +0000</pubDate>
		<dc:creator>xiaodao</dc:creator>
				<category><![CDATA[日常]]></category>

		<guid isPermaLink="false">http://www.shuizilong.com/house/?p=224</guid>
		<description><![CDATA[ARENA 01: Konoe Subaru [Gasai YUNO ] ARENA 02: [Elucia de Lute Ima ] Shimada Minami ARENA 03: Kanon Nakagawa [Shiomiya Shiori ] ARENA 04: Nakamura Yuri [Charlotte Dunois ] ARENA 05: [Honma Meiko ] Iwasawa Masami ARENA 06: Kashiwazaki &#8230; <a href="http://www.shuizilong.com/house/archives/test-2/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><span id="more-224"></span><br />
ARENA 01: <font><font>Konoe Subaru </font></font>  <span style='color: #0000DF;'><strong>[<font><font>Gasai YUNO </font></font>]</strong></span><br/><br />
ARENA 02: <span style='color: #0000DF;'><strong>[<font><font>Elucia de Lute Ima </font></font>]</strong></span>  <font><font>Shimada Minami </font></font><br/><br />
ARENA 03: <font><font>Kanon Nakagawa </font></font>  <span style='color: #0000DF;'><strong>[<font><font>Shiomiya Shiori </font></font>]</strong></span><br/><br />
ARENA 04: Nakamura Yuri  <span style='color: #0000DF;'><strong>[<font><font>Charlotte Dunois </font></font>]</strong></span><br/><br />
ARENA 05: <span style='color: #0000DF;'><strong>[<font><font>Honma Meiko </font></font>]</strong></span>  Iwasawa Masami<br/><br />
ARENA 06: <font><font>Kashiwazaki Sena </font></font>  <span style='color: #0000DF;'><strong>[<font><font>Hasegawa Kobato </font></font>]</strong></span><br/><br />
ARENA 07: <span style='color: #0000DF;'><strong>[<font><font>Mato Kuroi </font></font>]</strong></span>  Yui<br/><br />
ARENA 08: <span style='color: #0000DF;'><strong>[<font><font>Suzutsuki Kanade </font></font>]</strong></span>  <font><font>Aragaki Ayase </font></font><br/><br />
ARENA 09: <span style='color: #0000DF;'><strong>[<font><font>Yuzuriha anyone </font></font>]</strong></span>  <font><font>Eucliwood Hellscythe </font></font><br/><br />
ARENA 10: <span style='color: #0000DF;'><strong>[<font><font>Towa ERIO </font></font>]</strong></span>  <font><font>TACHIBANA Kanade </font></font><br/><br />
ARENA 11: <font><font>Akemi Homura </font></font> <span style='color: #EE0020;'><strong>[Abstained]</strong></span> <font><font>Makise Kurisu </font></font><br/><br />
ARENA 12: <font><font>Kasugano Sora </font></font> <span style='color: #EE0020;'><strong>[Abstained]</strong></span> <font><font>Haqua Herminium the Lot </font></font><br/><br />
ARENA 13: <font><font>Kosak Kirino </font></font> <span style='color: #EE0020;'><strong>[Abstained]</strong></span> <font><font>Victorique Blois </font></font><br/><br />
ARENA 14: <span style='color: #0000DF;'><strong>[<font><font>Sakura kyoko </font></font>]</strong></span>  <font><font>Kirishima Shoko </font></font><br/><br />
ARENA 15: <font><font>Kanzaki H. </font><font>Aria </font></font>  <span style='color: #0000DF;'><strong>[<font><font>Essential Ruri (Kuroneko) </font></font>]</strong></span><br/><br />
ARENA 16: <font><font>Much of Iris Einzbern </font></font> <span style='color: #EE0020;'><strong>[Abstained]</strong></span> <font><font>Mine Rico </font></font><br/><br />
ARENA 17: Fear Kubrick  <span style='color: #0000DF;'><strong>[<font><font>Kazuki Yozora </font></font>]</strong></span><br/><br />
ARENA 18: <span style='color: #0000DF;'><strong>[<font><font>Haruna </font></font>]</strong></span>  <font><font>Mizuki Himeji </font></font><br/><br />
ARENA 19: <span style='color: #0000DF;'><strong>[<font><font>Takanashi Sora </font></font>, <font><font>Takanashi Miu </font></font>]</strong></span>  <font><font>Kawakami Momoyo </font></font>, <font><font>Kazuko Kawakami </font></font><br/><br />
ARENA 20: Furukawa Nagisa <span style='color: #EE0020;'><strong>[Abstained]</strong></span> Ichinose Kotomi<br/><br />
ARENA 21: <font><font>Hiiragi Kagami </font></font>  <span style='color: #0000DF;'><strong>[<font><font>Hecate </font></font>]</strong></span><br/><br />
ARENA 22: <font><font>Nymph </font></font> <span style='color: #EE0020;'><strong>[Abstained]</strong></span> C.C.<br/><br />
ARENA 23: Hirasawa Yui <span style='color: #EE0020;'><strong>[Abstained]</strong></span> <font><font>Akiyama Mio </font></font><br/><br />
ARENA 24: <font><font>Shiina fuyu </font></font> <span style='color: #EE0020;'><strong>[Abstained]</strong></span> <font><font>Konate Izumi </font></font><br/><br />
ARENA 25: <font><font>Senjōgahara Hitagi </font></font>  <span style='color: #0000DF;'><strong>[<font><font>Haruhi Suzumiya </font></font>]</strong></span><br/><br />
ARENA 26: <font><font>Katsura Hinagiku </font></font> <span style='color: #EE0020;'><strong>[Abstained]</strong></span> <font><font>Nagato Yuki </font></font><br/><br />
ARENA 27: <font><font>Shirai parish </font></font> <span style='color: #EE0020;'><strong>[Abstained]</strong></span> <font><font>Sanzen&#8217;in Nagi </font></font><br/><br />
ARENA 28: <font><font>Oshino Shinobu </font></font>  <span style='color: #0000DF;'><strong>[Nakano Azusa]</strong></span><br/><br />
ARENA 29: <font><font>Tōsaka Rin </font></font>  <span style='color: #0000DF;'><strong>[<font><font>Shana </font></font>]</strong></span><br/><br />
ARENA 30: <font><font>Aisaka Taiga </font></font> <span style='color: #EE0020;'><strong>[Abstained]</strong></span> <font><font>Illyasviel of Einzbern </font></font><br/><br />
ARENA 31: <span style='color: #0000DF;'><strong>[<font><font>Kotobuki Tsumugi </font></font>]</strong></span>  <font><font>Kyo Fujibayashi </font></font><br/><br />
ARENA 32: <font><font>Sengoku Nadeko </font></font> <span style='color: #EE0020;'><strong>[Abstained]</strong></span> Saber<br/><br />
ARENA 33: <span style='color: #0000DF;'><strong>[Hirasawa Ui]</strong></span>  <font><font>IKAROS </font></font><br/><br />
ARENA 34: <font><font>Vallière Louise </font></font> <span style='color: #EE0020;'><strong>[Abstained]</strong></span> <font><font>Masaka Makoto </font></font><br/><br />
ARENA 35: Last Order <span style='color: #EE0020;'><strong>[Abstained]</strong></span> <font><font>Konjiki no yami </font></font><br/><br />
ARENA 36: <span style='color: #0000DF;'><strong>[<font><font>Wrestling Asahina </font></font>]</strong></span>  Sakagami Tomoyo<br/><br />
ARENA 37: <font><font>The index </font><font>Prohibited </font></font> <span style='color: #EE0020;'><strong>[Abstained]</strong></span> Holo<br/><br />
ARENA 38: <font><font>Kasugano Haruka </font></font>, <font><font>Kasugano Sora </font></font> <span style='color: #EE0020;'><strong>[Abstained]</strong></span> <font><font>Kinoshita Hideyoshi </font></font>, <font><font>Kinoshita Yūko </font></font><br/></p>
]]></content:encoded>
			<wfw:commentRss>http://www.shuizilong.com/house/archives/test-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PKU Campus 2012</title>
		<link>http://www.shuizilong.com/house/archives/pku-campus-2012-onhold/</link>
		<comments>http://www.shuizilong.com/house/archives/pku-campus-2012-onhold/#comments</comments>
		<pubDate>Mon, 14 May 2012 17:37:34 +0000</pubDate>
		<dc:creator>xiaodao</dc:creator>
				<category><![CDATA[ACM]]></category>
		<category><![CDATA[施工中]]></category>

		<guid isPermaLink="false">http://www.shuizilong.com/house/?p=222</guid>
		<description><![CDATA[Brief description: &#8230; Problem C. Lausanne Capitale Olympique 给定一个图，问是否从源点出发，到任意点的最短路径和次短路径的长度相差不超过 1 。。。 Analysis: &#8230; Problem C. Lausanne Capitale Olympique 做一次 bfs() 对所有不在最短路径树中的边，如果连接两点的层次一样则同时标记这两个顶点。。如果一高一低则标记高点。。 返回标记的顶点数是否 == n。 Problem F. &#8230; 。。先写个程序暴力一下 SG 。。。 稍微整理下得到以下数据。。 1 0 010 012210 010 012214414412210 010 012210 01 &#8230; <a href="http://www.shuizilong.com/house/archives/pku-campus-2012-onhold/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><span id="more-222"></span></p>
<h3>Brief description: </h3>
<p>&#8230;<br />
Problem C. Lausanne Capitale Olympique<br />
给定一个图，问是否从源点出发，到任意点的最短路径和次短路径的长度相差不超过 1 。。。</p>
<h3>Analysis: </h3>
<p>&#8230;</p>
<p>Problem C. Lausanne Capitale Olympique<br />
做一次 bfs() 对所有不在最短路径树中的边，如果连接两点的层次一样则同时标记这两个顶点。。如果一高一低则标记高点。。<br />
返回标记的顶点数是否 == n。</p>
<p>Problem F. &#8230;<br />
。。先写个程序暴力一下 SG 。。。</p>
<pre class="brush: cpp; collapse: true; first-line: 1; light: false; title: 暴力SG_1.cpp; toolbar: true; notranslate">
const int N = 1024;
int SG[N], n;
VI tmp;

int mex(VI&amp; tmp){
    if (tmp[0] != 0) return 0;
    FOR(i, 1, SZ(tmp)) if (tmp[i] - tmp[i-1] != 1){
        return tmp[i-1] + 1;
    }
    return tmp[SZ(tmp) - 1] + 1;
}

int main(){

    freopen(&quot;out.txt&quot;, &quot;w&quot;, stdout);

    n = 1024;

    SG[0] = 1, SG[1] = 0;

    FOR(i, 2, n){
        CLR(tmp); REP_1(j, i/2) tmp.PB(SG[i - j] ^ SG[i - 2 * j]);
        SRT(tmp); tmp.resize(unique(ALL(tmp)) - tmp.begin()); SG[i] = mex(tmp);
    }

    REP(i, n){
        if (!SG[i] &amp;&amp; !SG[i+1]) cout &lt;&lt; endl;
        cout &lt;&lt; SG[i];
    }
}
</pre>
<p>稍微整理下得到以下数据。。</p>
<pre>
1
0
010
012210
010
012214414412210
010
012210
01
001221441441221771771221771771221441441221
001
001221
001
001221441441221
001
001221
001
001221441441221771771221771771221441441221881881221881881221441441221881881221881881221441441221771771221771771221441441221
001
001221
001
001221441441221
001
001221
001
001221441441221771771221771771221441441221
001
001221
001
001221441441221
001
001221
001
00122144144122177177122177177122144144122188188122188188122144144122188188122188188122144144122177177122177177122144144122111111111112211111111111221441441221111111111122111111111112214414412217717712217717712214414412211111111111221111111111122144144122111111111112211111111111221441441221771771221771771221441441221881881221881881221441441221881881221881881221441441221771771221771771221441441221
</pre>
<p>这样规律性就已经显现了。。中间的 Pattern 类似某种树状数组的东西。。<br />
中间又出现了 1, 2, 5, 14, 51, 152 这样的数列。。（差分一下是 a[n] = 3n &#8211; 1)。。。<br />
。。重新整理。。</p>
<pre class="brush: cpp; collapse: true; first-line: 1; light: false; title: Regroup.cpp; toolbar: true; notranslate">
const int N = 1&lt;&lt;10;
int SG[N], n;
VI tmp;

int mex(VI&amp; tmp){
    if (tmp[0] != 0) return 0;
    FOR(i, 1, SZ(tmp)) if (tmp[i] - tmp[i-1] != 1){
        return tmp[i-1] + 1;
    }
    return tmp[SZ(tmp) - 1] + 1;
}

int main(){

    freopen(&quot;out.txt&quot;, &quot;w&quot;, stdout);

    n = N;

    SG[0] = 1, SG[1] = 0;

    FOR(i, 2, n){
        CLR(tmp); REP_1(j, i/2) tmp.PB(SG[i - j] ^ SG[i - 2 * j]);
        SRT(tmp); tmp.resize(unique(ALL(tmp)) - tmp.begin()); SG[i] = mex(tmp);
    } 

    int cnt = 0; REP(i, n){
        printf(&quot;%c&quot;, (SG[i] &lt;= 10 ? '0' : ('A' - 10)) + SG[i]);
        if (!SG[i]){
            if (++cnt&amp;1) cout &lt;&lt; endl;
        }
    }
}
</pre>
<pre class="brush: cpp; collapse: true; first-line: 1; light: false; title: Problem C. Lausanne Capitale Olympique; toolbar: true; notranslate">
const int N = 10009;

VI adj[N]; MIB used[N]; int q[N], d[N], head, tail;
bool bj[N]; int cnt;
int n, m;

void init(){
    REP(i, n) CLR(adj[i]), CLR(used[i]);
    int x, y; REP(i, m){
        RD(x, y); --x, --y;
        adj[x].PB(y), adj[y].PB(x);
    }
}

void bfs(){
    RST(d), d[0] = 1, q[head = 0] = 0, tail = 1;

    while (head &lt; tail){

        int u = q[head++];

#define v adj[u][i]

        REP(i, SZ(adj[u])) if (!d[v]){
            d[v] = d[u] + 1, used[u][v] = used[v][u] = true;
            q[tail++] = v;
        }
    }
}

void tick(int x){
    if (!bj[x]) bj[x] = true, ++cnt;
}

int check(){
    RST(bj); bj[0] = true, cnt = 1;

    REP(u, n) REP(i, SZ(adj[u])) if (!used[u][v]){
        if (d[u] == d[v]) tick(u), tick(v);
        else tick(d[u] &gt; d[v] ? u : v);
    }

    return cnt == n;
}

int main(){
    while (scanf(&quot;%d %d&quot;, &amp;n, &amp;m) != EOF){
        init(); bfs();
        cout &lt;&lt; check() &lt;&lt; endl;
    }
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.shuizilong.com/house/archives/pku-campus-2012-onhold/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Code Jam 2012 Round 1B</title>
		<link>http://www.shuizilong.com/house/archives/google-code-jam-2012-round-1b/</link>
		<comments>http://www.shuizilong.com/house/archives/google-code-jam-2012-round-1b/#comments</comments>
		<pubDate>Sat, 05 May 2012 19:35:41 +0000</pubDate>
		<dc:creator>xiaodao</dc:creator>
				<category><![CDATA[Google Code Jam]]></category>

		<guid isPermaLink="false">http://www.shuizilong.com/house/?p=217</guid>
		<description><![CDATA[Brief description: A: 二分答案贪心。 B: 两次 bfs(); C: 。子集合问题，问是否存在两个不相交的子集，使得它们的和相等 0w0。。]]></description>
			<content:encoded><![CDATA[<h3>Brief description: </h3>
<p>A: 二分答案贪心。<br />
B: 两次 bfs();<br />
C: 。子集合问题，问是否存在两个不相交的子集，使得它们的和相等 0w0。。</p>
<p><span id="more-217"></span></p>
<pre class="brush: cpp; collapse: true; first-line: 1; light: false; title: ; toolbar: true; notranslate">
/** ` Micro Mezzo Macro Flation -- Overheated Economy ., **/

#include &lt;algorithm&gt;
#include &lt;iostream&gt;
#include &lt;iomanip&gt;
#include &lt;sstream&gt;
#include &lt;cstring&gt;
#include &lt;cstdio&gt;
#include &lt;string&gt;
#include &lt;vector&gt;
#include &lt;bitset&gt;
#include &lt;queue&gt;
#include &lt;stack&gt;
#include &lt;cmath&gt;
#include &lt;ctime&gt;
#include &lt;list&gt;
#include &lt;set&gt;
#include &lt;map&gt;

using namespace std;

#define REP(i, n) for (int i=0;i&lt;int(n);++i)
#define FOR(i, a, b) for (int i=int(a);i&lt;int(b);++i)
#define DWN(i, b, a) for (int i=int(b-1);i&gt;=int(a);--i)
#define REP_1(i, n) for (int i=1;i&lt;=int(n);++i)
#define FOR_1(i, a, b) for (int i=int(a);i&lt;=int(b);++i)
#define DWN_1(i, b, a) for (int i=int(b);i&gt;=int(a);--i)
#define REP_C(i, n) for (int n____=int(n),i=0;i&lt;n____;++i)
#define FOR_C(i, a, b) for (int b____=int(b),i=a;i&lt;b____;++i)
#define DWN_C(i, b, a) for (int a____=int(a),i=b-1;i&gt;=a____;--i)
#define REP_N(i, n) for (i=0;i&lt;int(n);++i)
#define FOR_N(i, a, b) for (i=int(a);i&lt;int(b);++i)
#define DWN_N(i, b, a) for (i=int(b-1);i&gt;=int(a);--i)
#define REP_1_C(i, n) for (int n____=int(n),i=1;i&lt;=n____;++i)
#define FOR_1_C(i, a, b) for (int b____=int(b),i=a;i&lt;=b____;++i)
#define DWN_1_C(i, b, a) for (int a____=int(a),i=b;i&gt;=a____;--i)
#define REP_1_N(i, n) for (i=1;i&lt;=int(n);++i)
#define FOR_1_N(i, a, b) for (i=int(a);i&lt;=int(b);++i)
#define DWN_1_N(i, b, a) for (i=int(b);i&gt;=int(a);--i)
#define REP_C_N(i, n) for (n____=int(n),i=0;i&lt;n____;++i)
#define FOR_C_N(i, a, b) for (b____=int(b),i=a;i&lt;b____;++i)
#define DWN_C_N(i, b, a) for (a____=int(a),i=b-1;i&gt;=a____;--i)
#define REP_1_C_N(i, n) for (n____=int(n),i=1;i&lt;=n____;++i)
#define FOR_1_C_N(i, a, b) for (b____=int(b),i=a;i&lt;=b____;++i)
#define DWN_1_C_N(i, b, a) for (a____=int(a),i=b;i&gt;=a____;--i)

#define ECH(it, A) for (typeof(A.begin()) it=A.begin(); it != A.end(); ++it)
#define DO(n) while(n--)
#define DO_C(n) int n____ = n; while(n____--)
#define TO(i, a, b) int s_=a&lt;b?1:-1,b_=b+s_;for(int i=a;i!=b_;i+=s_)
#define TO_1(i, a, b) int s_=a&lt;b?1:-1,b_=b;for(int i=a;i!=b_;i+=s_)
#define SQZ(i, j, a, b) for (int i=int(a),j=int(b)-1;i&lt;j;++i,--j)
#define SQZ_1(i, j, a, b) for (int i=int(a),j=int(b);i&lt;=j;++i,--j)
#define REP_2(i, j, n, m) REP(i, n) REP(j, m)
#define REP_2_1(i, j, n, m) REP_1(i, n) REP_1(j, m)

#define ALL(A) A.begin(), A.end()
#define LLA(A) A.rbegin(), A.rend()
#define CPY(A, B) memcpy(A, B, sizeof(A))
#define INS(A, P, B) A.insert(A.begin() + P, B)
#define ERS(A, P) A.erase(A.begin() + P)
#define BSC(A, X) find(ALL(A), X) // != A.end()
#define CTN(T, x) (T.find(x) != T.end())
#define SZ(A) int(A.size())
#define PB push_back
#define MP(A, B) make_pair(A, B)

#define Rush int T____; RD(T____); DO(T____)
#pragma comment(linker, &quot;/STACK:36777216&quot;)
//#pragma GCC optimize (&quot;O2&quot;)
#define Ruby system(&quot;ruby main.rb&quot;)
#define Haskell system(&quot;runghc main.hs&quot;)
#define Pascal system(&quot;fpc main.pas&quot;)

typedef long long LL;
typedef double DB;
typedef unsigned UINT;
typedef unsigned long long ULL;

typedef vector&lt;int&gt; VI;
typedef vector&lt;char&gt; VC;
typedef vector&lt;string&gt; VS;
typedef vector&lt;LL&gt; VL;
typedef vector&lt;DB&gt; VD;
typedef set&lt;int&gt; SI;
typedef set&lt;string&gt; SS;
typedef set&lt;LL&gt; SL;
typedef set&lt;DB&gt; SD;
typedef map&lt;int, int&gt; MII;
typedef map&lt;string, int&gt; MSI;
typedef map&lt;LL, int&gt; MLI;
typedef map&lt;DB, int&gt; MDI;
typedef map&lt;int, bool&gt; MIB;
typedef map&lt;string, bool&gt; MSB;
typedef map&lt;LL, bool&gt; MLB;
typedef map&lt;DB, bool&gt; MDB;
typedef pair&lt;int, int&gt; PII;
typedef pair&lt;int, bool&gt; PIB;
typedef vector&lt;PII&gt; VII;
typedef vector&lt;VI&gt; VVI;
typedef vector&lt;VII&gt; VVII;
typedef set&lt;PII&gt; SII;
typedef map&lt;PII, int&gt; MPIII;
typedef map&lt;PII, bool&gt; MPIIB;

/** I/O Accelerator **/

/* ... :&quot; We are I/O Accelerator ... Use us at your own risk ;) ... &quot; .. */

template&lt;class T&gt; inline void RD(T &amp;);
template&lt;class T&gt; inline void OT(const T &amp;);

inline int RD(){ int x; RD(x); return x;}
template&lt;class T&gt; inline T&amp; _RD(T &amp;x){ RD(x); return x;}
inline void RC(char &amp;c){scanf(&quot; %c&quot;, &amp;c);}
inline void RS(char *s){scanf(&quot;%s&quot;, s);}

template&lt;class T0, class T1&gt; inline void RD(T0 &amp;x0, T1 &amp;x1){RD(x0), RD(x1);}
template&lt;class T0, class T1, class T2&gt; inline void RD(T0 &amp;x0, T1 &amp;x1, T2 &amp;x2){RD(x0), RD(x1), RD(x2);}
template&lt;class T0, class T1, class T2, class T3&gt; inline void RD(T0 &amp;x0, T1 &amp;x1, T2 &amp;x2, T3 &amp;x3){RD(x0), RD(x1), RD(x2), RD(x3);}
template&lt;class T0, class T1, class T2, class T3, class T4&gt; inline void RD(T0 &amp;x0, T1 &amp;x1, T2 &amp;x2, T3 &amp;x3, T4 &amp;x4){RD(x0), RD(x1), RD(x2), RD(x3), RD(x4);}
template&lt;class T0, class T1, class T2, class T3, class T4, class T5&gt; inline void RD(T0 &amp;x0, T1 &amp;x1, T2 &amp;x2, T3 &amp;x3, T4 &amp;x4, T5 &amp;x5){RD(x0), RD(x1), RD(x2), RD(x3), RD(x4), RD(x5);}
template&lt;class T0, class T1, class T2, class T3, class T4, class T5, class T6&gt; inline void RD(T0 &amp;x0, T1 &amp;x1, T2 &amp;x2, T3 &amp;x3, T4 &amp;x4, T5 &amp;x5, T6 &amp;x6){RD(x0), RD(x1), RD(x2), RD(x3), RD(x4), RD(x5), RD(x6);}
template&lt;class T0, class T1&gt; inline void OT(T0 &amp;x0, T1 &amp;x1){OT(x0), OT(x1);}
template&lt;class T0, class T1, class T2&gt; inline void OT(T0 &amp;x0, T1 &amp;x1, T2 &amp;x2){OT(x0), OT(x1), OT(x2);}
template&lt;class T0, class T1, class T2, class T3&gt; inline void OT(T0 &amp;x0, T1 &amp;x1, T2 &amp;x2, T3 &amp;x3){OT(x0), OT(x1), OT(x2), OT(x3);}
template&lt;class T0, class T1, class T2, class T3, class T4&gt; inline void OT(T0 &amp;x0, T1 &amp;x1, T2 &amp;x2, T3 &amp;x3, T4 &amp;x4){OT(x0), OT(x1), OT(x2), OT(x3), OT(x4);}
template&lt;class T0, class T1, class T2, class T3, class T4, class T5&gt; inline void OT(T0 &amp;x0, T1 &amp;x1, T2 &amp;x2, T3 &amp;x3, T4 &amp;x4, T5 &amp;x5){OT(x0), OT(x1), OT(x2), OT(x3), OT(x4), OT(x5);}
template&lt;class T0, class T1, class T2, class T3, class T4, class T5, class T6&gt; inline void OT(T0 &amp;x0, T1 &amp;x1, T2 &amp;x2, T3 &amp;x3, T4 &amp;x4, T5 &amp;x5, T6 &amp;x6){OT(x0), OT(x1), OT(x2), OT(x3), OT(x4), OT(x5), OT(x6);}

template&lt;class T&gt; inline void RST(T &amp;A){memset(A, 0, sizeof(A));}
template&lt;class T0, class T1&gt; inline void RST(T0 &amp;A0, T1 &amp;A1){RST(A0), RST(A1);}
template&lt;class T0, class T1, class T2&gt; inline void RST(T0 &amp;A0, T1 &amp;A1, T2 &amp;A2){RST(A0), RST(A1), RST(A2);}
template&lt;class T0, class T1, class T2, class T3&gt; inline void RST(T0 &amp;A0, T1 &amp;A1, T2 &amp;A2, T3 &amp;A3){RST(A0), RST(A1), RST(A2), RST(A3);}
template&lt;class T0, class T1, class T2, class T3, class T4&gt; inline void RST(T0 &amp;A0, T1 &amp;A1, T2 &amp;A2, T3 &amp;A3, T4 &amp;A4){RST(A0), RST(A1), RST(A2), RST(A3), RST(A4);}
template&lt;class T0, class T1, class T2, class T3, class T4, class T5&gt; inline void RST(T0 &amp;A0, T1 &amp;A1, T2 &amp;A2, T3 &amp;A3, T4 &amp;A4, T5 &amp;A5){RST(A0), RST(A1), RST(A2), RST(A3), RST(A4), RST(A5);}
template&lt;class T0, class T1, class T2, class T3, class T4, class T5, class T6&gt; inline void RST(T0 &amp;A0, T1 &amp;A1, T2 &amp;A2, T3 &amp;A3, T4 &amp;A4, T5 &amp;A5, T6 &amp;A6){RST(A0), RST(A1), RST(A2), RST(A3), RST(A4), RST(A5), RST(A6);}

template&lt;class T&gt; inline void CLR(T &amp;A){A.clear();}
template&lt;class T0, class T1&gt; inline void CLR(T0 &amp;A0, T1 &amp;A1){CLR(A0), CLR(A1);}
template&lt;class T0, class T1, class T2&gt; inline void CLR(T0 &amp;A0, T1 &amp;A1, T2 &amp;A2){CLR(A0), CLR(A1), CLR(A2);}
template&lt;class T0, class T1, class T2, class T3&gt; inline void CLR(T0 &amp;A0, T1 &amp;A1, T2 &amp;A2, T3 &amp;A3){CLR(A0), CLR(A1), CLR(A2), CLR(A3);}
template&lt;class T0, class T1, class T2, class T3, class T4&gt; inline void CLR(T0 &amp;A0, T1 &amp;A1, T2 &amp;A2, T3 &amp;A3, T4 &amp;A4){CLR(A0), CLR(A1), CLR(A2), CLR(A3), CLR(A4);}
template&lt;class T0, class T1, class T2, class T3, class T4, class T5&gt; inline void CLR(T0 &amp;A0, T1 &amp;A1, T2 &amp;A2, T3 &amp;A3, T4 &amp;A4, T5 &amp;A5){CLR(A0), CLR(A1), CLR(A2), CLR(A3), CLR(A4), CLR(A5);}
template&lt;class T0, class T1, class T2, class T3, class T4, class T5, class T6&gt; inline void CLR(T0 &amp;A0, T1 &amp;A1, T2 &amp;A2, T3 &amp;A3, T4 &amp;A4, T5 &amp;A5, T6 &amp;A6){CLR(A0), CLR(A1), CLR(A2), CLR(A3), CLR(A4), CLR(A5), CLR(A6);}
template&lt;class T&gt; inline void CLR(T &amp;A, int n){REP(i, n) CLR(A[i]);}
template&lt;class T&gt; inline void FLC(T &amp;A, int x){memset(A, x, sizeof(A));}
template&lt;class T0, class T1&gt; inline void FLC(T0 &amp;A0, T1 &amp;A1, int x){FLC(A0, x), FLC(A1, x);}
template&lt;class T0, class T1, class T2&gt; inline void FLC(T0 &amp;A0, T1 &amp;A1, T2 &amp;A2){FLC(A0), FLC(A1), FLC(A2);}
template&lt;class T0, class T1, class T2, class T3&gt; inline void FLC(T0 &amp;A0, T1 &amp;A1, T2 &amp;A2, T3 &amp;A3){FLC(A0), FLC(A1), FLC(A2), FLC(A3);}
template&lt;class T0, class T1, class T2, class T3, class T4&gt; inline void FLC(T0 &amp;A0, T1 &amp;A1, T2 &amp;A2, T3 &amp;A3, T4 &amp;A4){FLC(A0), FLC(A1), FLC(A2), FLC(A3), FLC(A4);}
template&lt;class T0, class T1, class T2, class T3, class T4, class T5&gt; inline void FLC(T0 &amp;A0, T1 &amp;A1, T2 &amp;A2, T3 &amp;A3, T4 &amp;A4, T5 &amp;A5){FLC(A0), FLC(A1), FLC(A2), FLC(A3), FLC(A4), FLC(A5);}
template&lt;class T0, class T1, class T2, class T3, class T4, class T5, class T6&gt; inline void FLC(T0 &amp;A0, T1 &amp;A1, T2 &amp;A2, T3 &amp;A3, T4 &amp;A4, T5 &amp;A5, T6 &amp;A6){FLC(A0), FLC(A1), FLC(A2), FLC(A3), FLC(A4), FLC(A5), FLC(A6);}

template&lt;class T&gt; inline void SRT(T &amp;A){sort(ALL(A));}
template&lt;class T, class C&gt; inline void SRT(T &amp;A, C B){sort(ALL(A), B);}

/** Add - On **/

const int MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const DB EPS = 1e-9;
const DB OO = 1e15;
const DB PI = 3.14159265358979323846264;//M_PI;

// &lt;&lt;= ` 0. Daily Use .,

template&lt;class T&gt; inline void checkMin(T &amp;a,const T b){if (b&lt;a) a=b;}
template&lt;class T&gt; inline void checkMax(T &amp;a,const T b){if (b&gt;a) a=b;}
template &lt;class T, class C&gt; inline void checkMin(T&amp; a, const T b, C c){if (c(b,a)) a = b;}
template &lt;class T, class C&gt; inline void checkMax(T&amp; a, const T b, C c){if (c(a,b)) a = b;}
template&lt;class T&gt; inline T min(T a, T b, T c){return min(min(a, b), c);}
template&lt;class T&gt; inline T max(T a, T b, T c){return max(max(a, b), c);}
template&lt;class T&gt; inline T min(T a, T b, T c, T d){return min(min(a, b), min(c, d));}
template&lt;class T&gt; inline T max(T a, T b, T c, T d){return max(min(a, b), max(c, d));}
template&lt;class T&gt; inline T sqr(T a){return a*a;}
template&lt;class T&gt; inline T cub(T a){return a*a*a;}
int Ceil(int x, int y){return (x - 1) / y + 1;}

// &lt;&lt;= ` 1. Bitwise Operation .,

inline bool _1(int x, int i){return x &amp; 1&lt;&lt;i;}
inline int _1(int i){return 1&lt;&lt;i;}
inline int _U(int i){return _1(i) - 1;};

inline int count_bits(int x){
    x = (x &amp; 0x55555555) + ((x &amp; 0xaaaaaaaa) &gt;&gt; 1);
    x = (x &amp; 0x33333333) + ((x &amp; 0xcccccccc) &gt;&gt; 2);
    x = (x &amp; 0x0f0f0f0f) + ((x &amp; 0xf0f0f0f0) &gt;&gt; 4);
    x = (x &amp; 0x00ff00ff) + ((x &amp; 0xff00ff00) &gt;&gt; 8);
    x = (x &amp; 0x0000ffff) + ((x &amp; 0xffff0000) &gt;&gt; 16);
    return x;
}

template&lt;class T&gt; inline T low_bit(T x) {
    return x &amp; -x;
}

template&lt;class T&gt; inline T high_bit(T x) {
    T p = low_bit(x);
    while (p != x) x -= p, p = low_bit(x);
    return p;
}

// &lt;&lt;= ' 0. I/O Accelerator interface .,

template&lt;class T&gt; inline void RD(T &amp;x){
    //cin &gt;&gt; x;
    scanf(&quot;%d&quot;, &amp;x);
    //char c; for (c = getchar(); c &lt; '0'; c = getchar()); x = c - '0'; for (c = getchar(); c &gt;= '0'; c = getchar()) x = x * 10 + c - '0';
    //char c; c = getchar(); x = c - '0'; for (c = getchar(); c &gt;= '0'; c = getchar()) x = x * 10 + c - '0';
}

int ____Case;
template&lt;class T&gt; inline void OT(const T &amp;x){
    //printf(&quot;Case #%d: &quot;, ++____Case);
    printf(&quot;%d&quot;, x);
    puts(&quot;&quot;);
}

/* .................................................................................................................................. */

const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int N = 109;

int bottom[N][N], upper[N][N];
int h, n, m;

inline int water_leval(int t){
    return h - t;
}

struct state{
    int x, y, t;

    state(int _x, int _y, int _t):x(_x), y(_y), t(_t){}

    int speed(){
        if (water_leval(t) - bottom[x][y] &gt;= 20) return 10;
        return 100;
    }

    friend bool operator &lt;(const state&amp; lhs, const state&amp; rhs){
        return lhs.t &lt; rhs.t;
    }
    friend bool operator &gt;(const state&amp; lhs, const state&amp; rhs){
        return lhs.t &gt; rhs.t;
    }
};

priority_queue&lt;state, vector&lt;state&gt;, greater&lt;state&gt; &gt; Q;
vector&lt;PII&gt; _Q; int head;

inline bool legal(int x, int y){
    return upper[x][y] - bottom[x][y] &gt;= 50;
}

inline bool link(int x, int y, int xx, int yy){
    return legal(xx, yy) &amp;&amp; upper[xx][yy] - bottom[x][y] &gt;= 50 &amp;&amp; upper[x][y] - bottom[xx][yy] &gt;= 50;
}

int open_time(int x, int y, int xx, int yy, int t){
    if (!legal(xx, yy)) return INF;

    return max(
        (upper[xx][yy] - bottom[x][y] &gt;= 50) ? (water_leval(t) - upper[xx][yy] + 50) : INF,
            (upper[x][y] - bottom[xx][yy] &gt;= 50) ? (water_leval(t) - upper[x][y] + 50) : INF, 0);

}

void init(){
    RD(h, n, m); RST(bottom, upper);
    REP_2_1(i, j, n, m) RD(upper[i][j]);
    REP_2_1(i, j, n, m) RD(bottom[i][j]);
    CLR(_Q); while (!Q.empty()) Q.pop();
}

bool C[N][N];

void bfs1(){

    _Q.PB(MP(1, 1)); RST(C); C[1][1] = true; head = 0;

    while (head &lt; SZ(_Q)){

        int x = _Q[head].first, y = _Q[head].second;

        REP(i, 4){
            int xx = x + dx[i], yy = y + dy[i];
            if (!C[xx][yy] &amp;&amp; link(x, y, xx, yy)){
                if (!open_time(x, y, xx, yy, 0)){
                    _Q.PB(MP(xx, yy));
                    C[xx][yy] = true;
                }
            }
        }

        ++head;
    }
}

void bfs2(){

    RST(C); REP(i, SZ(_Q)) Q.push(state(_Q[i].first, _Q[i].second, 0));

    while (!Q.empty()){

        state u = Q.top(); Q.pop();
        if (C[u.x][u.y]) continue;
        C[u.x][u.y] = true;

        if (u.x == n &amp;&amp; u.y == m){
            printf(&quot;%.1lf\n&quot;, (DB) u.t / 10);
            return;
        }

        REP(i, 4){

            int xx = u.x + dx[i], yy = u.y + dy[i];

            if (C[xx][yy]) continue;

            if (link(u.x, u.y, xx, yy)){
                int tt = open_time(u.x, u.y, xx, yy, u.t);
                u.t += tt;
                Q.push( state(xx, yy, u.t + u.speed()));
                u.t -= tt;
            }
        }
    }
}

int main(){

    //freopen(&quot;B-large-practice.in&quot;, &quot;r&quot;, stdin);
    //freopen(&quot;A-large.in&quot;, &quot;r&quot;, stdin);
    freopen(&quot;in.txt&quot;, &quot;r&quot;, stdin);
    freopen(&quot;out.txt&quot;, &quot;w&quot;, stdout);

    Rush{
        printf(&quot;Case #%d: &quot;, ++____Case);
        init(); bfs1(); bfs2();
    }
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.shuizilong.com/house/archives/google-code-jam-2012-round-1b/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>&#8230; The meaning of my handle &#8220;xiaodao&#8221; &#8230;</title>
		<link>http://www.shuizilong.com/house/archives/meaning-of-my-handle/</link>
		<comments>http://www.shuizilong.com/house/archives/meaning-of-my-handle/#comments</comments>
		<pubDate>Fri, 04 May 2012 18:05:06 +0000</pubDate>
		<dc:creator>xiaodao</dc:creator>
				<category><![CDATA[日常]]></category>
		<category><![CDATA[黑历史]]></category>

		<guid isPermaLink="false">http://www.shuizilong.com/house/?p=214</guid>
		<description><![CDATA[TC 正在调查大家 handle 的黑历史。。。。据说能抽出神秘小礼物。。。大家赶快去自爆吧。。>]]></description>
			<content:encoded><![CDATA[<p><a href="http://community.topcoder.com/tco12/get-free-stuff-tell-me-the-meaning-of-your-handle/"> TC 正在调查大家 handle 的黑历史。。</a>。。据说能抽出神秘小礼物。。。大家赶快去自爆吧。。> <<br />
。。下面是我写的。。。(语法错误忽视掉就可以了。。)<br />
<span id="more-214"></span><br />
&#8230; My handle &#8220;xiaodao&#8221; has been used by a ZJU&#8217;s senior called &#8220;宏雨 魏&#8221;, and it transport to me since 2011 Apr. In my view, the handle is symbolic as the Chinese Character &#8220;島&#8221;, which in the Literal meaning .. island. A lot of concept will flashed across our mind, the British ship of the line, the windmills &#038;&#038; lighthouses of the Netherlands, the oriental cherry of Japan, not even something about Taiwan. But what is the island truely stand for? In fact it&#8217;s not a actual existence, something more like the <em>neverland</em> described in <a href="http://en.wikipedia.org/wiki/Peter_Pan"><em>Peter Pan</em></a>, it&#8217;s a idealization symbol about democracy &#038;&#038; science.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shuizilong.com/house/archives/meaning-of-my-handle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ZOJ 1450. Minimal Circle</title>
		<link>http://www.shuizilong.com/house/archives/zoj-1450-minimal-circle/</link>
		<comments>http://www.shuizilong.com/house/archives/zoj-1450-minimal-circle/#comments</comments>
		<pubDate>Sun, 29 Apr 2012 05:39:03 +0000</pubDate>
		<dc:creator>xiaodao</dc:creator>
				<category><![CDATA[ZOJ]]></category>
		<category><![CDATA[缺少分析]]></category>

		<guid isPermaLink="false">http://www.shuizilong.com/house/?p=203</guid>
		<description><![CDATA[Brief description: 最小圆覆盖模板题。 Analysis: 。。。 External link: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=450]]></description>
			<content:encoded><![CDATA[<h3>Brief description: </h3>
<p>最小圆覆盖模板题。<br />
<span id="more-203"></span></p>
<h3>Analysis: </h3>
<p>。。。</p>
<pre class="brush: cpp; light: false; title: ; toolbar: true; notranslate">
/** ` Micro Mezzo Macro Flation -- Overheated Economy ., **/

#include &lt;algorithm&gt;
#include &lt;iostream&gt;
#include &lt;iomanip&gt;
#include &lt;sstream&gt;
#include &lt;cstring&gt;
#include &lt;cstdio&gt;
#include &lt;string&gt;
#include &lt;vector&gt;
#include &lt;bitset&gt;
#include &lt;queue&gt;
#include &lt;stack&gt;
#include &lt;cmath&gt;
#include &lt;ctime&gt;
#include &lt;list&gt;
#include &lt;set&gt;
#include &lt;map&gt;

using namespace std;

#define REP(i, n) for (int i=0;i&lt;int(n);++i)
#define FOR(i, a, b) for (int i=int(a);i&lt;int(b);++i)
#define DWN(i, b, a) for (int i=int(b-1);i&gt;=int(a);--i)
#define REP_1(i, n) for (int i=1;i&lt;=int(n);++i)
#define FOR_1(i, a, b) for (int i=int(a);i&lt;=int(b);++i)
#define DWN_1(i, b, a) for (int i=int(b);i&gt;=int(a);--i)
#define REP_C(i, n) for (int n____=int(n),i=0;i&lt;n____;++i)
#define FOR_C(i, a, b) for (int b____=int(b),i=a;i&lt;b____;++i)
#define DWN_C(i, b, a) for (int a____=int(a),i=b-1;i&gt;=a____;--i)
#define REP_N(i, n) for (i=0;i&lt;int(n);++i)
#define FOR_N(i, a, b) for (i=int(a);i&lt;int(b);++i)
#define DWN_N(i, b, a) for (i=int(b-1);i&gt;=int(a);--i)
#define REP_1_C(i, n) for (int n____=int(n),i=1;i&lt;=n____;++i)
#define FOR_1_C(i, a, b) for (int b____=int(b),i=a;i&lt;=b____;++i)
#define DWN_1_C(i, b, a) for (int a____=int(a),i=b;i&gt;=a____;--i)
#define REP_1_N(i, n) for (i=1;i&lt;=int(n);++i)
#define FOR_1_N(i, a, b) for (i=int(a);i&lt;=int(b);++i)
#define DWN_1_N(i, b, a) for (i=int(b);i&gt;=int(a);--i)
#define REP_C_N(i, n) for (n____=int(n),i=0;i&lt;n____;++i)
#define FOR_C_N(i, a, b) for (b____=int(b),i=a;i&lt;b____;++i)
#define DWN_C_N(i, b, a) for (a____=int(a),i=b-1;i&gt;=a____;--i)
#define REP_1_C_N(i, n) for (n____=int(n),i=1;i&lt;=n____;++i)
#define FOR_1_C_N(i, a, b) for (b____=int(b),i=a;i&lt;=b____;++i)
#define DWN_1_C_N(i, b, a) for (a____=int(a),i=b;i&gt;=a____;--i)

#define ECH(it, A) for (typeof(A.begin()) it=A.begin(); it != A.end(); ++it)
#define DO(n) while(n--)
#define DO_C(n) int n____ = n; while(n____--)
#define TO(i, a, b) int s_=a&lt;b?1:-1,b_=b+s_;for(int i=a;i!=b_;i+=s_)
#define TO_1(i, a, b) int s_=a&lt;b?1:-1,b_=b;for(int i=a;i!=b_;i+=s_)
#define SQZ(i, j, a, b) for (int i=int(a),j=int(b)-1;i&lt;j;++i,--j)
#define SQZ_1(i, j, a, b) for (int i=int(a),j=int(b);i&lt;=j;++i,--j)
#define REP_2(i, j, n, m) REP(i, n) REP(j, m)
#define REP_2_1(i, j, n, m) REP_1(i, n) REP_1(j, m)

#define ALL(A) A.begin(), A.end()
#define LLA(A) A.rbegin(), A.rend()
#define CPY(A, B) memcpy(A, B, sizeof(A))
#define INS(A, P, B) A.insert(A.begin() + P, B)
#define ERS(A, P) A.erase(A.begin() + P)
#define BSC(A, X) find(ALL(A), X) // != A.end()
#define CTN(T, x) (T.find(x) != T.end())
#define SZ(A) int(A.size())
#define PB push_back
#define MP(A, B) make_pair(A, B)

#define Rush int T____; RD(T____); DO(T____)
#pragma comment(linker, &quot;/STACK:36777216&quot;)
//#pragma GCC optimize (&quot;O2&quot;)
#define Ruby system(&quot;ruby main.rb&quot;)
#define Haskell system(&quot;runghc main.hs&quot;)
#define Pascal system(&quot;fpc main.pas&quot;)

typedef long long LL;
typedef double DB;
typedef unsigned UINT;
typedef unsigned long long ULL;

typedef vector&lt;int&gt; VI;
typedef vector&lt;char&gt; VC;
typedef vector&lt;string&gt; VS;
typedef vector&lt;LL&gt; VL;
typedef vector&lt;DB&gt; VD;
typedef set&lt;int&gt; SI;
typedef set&lt;string&gt; SS;
typedef set&lt;LL&gt; SL;
typedef set&lt;DB&gt; SD;
typedef map&lt;int, int&gt; MII;
typedef map&lt;string, int&gt; MSI;
typedef map&lt;LL, int&gt; MLI;
typedef map&lt;DB, int&gt; MDI;
typedef map&lt;int, bool&gt; MIB;
typedef map&lt;string, bool&gt; MSB;
typedef map&lt;LL, bool&gt; MLB;
typedef map&lt;DB, bool&gt; MDB;
typedef pair&lt;int, int&gt; PII;
typedef pair&lt;int, bool&gt; PIB;
typedef vector&lt;PII&gt; VII;
typedef vector&lt;VI&gt; VVI;
typedef vector&lt;VII&gt; VVII;
typedef set&lt;PII&gt; SII;
typedef map&lt;PII, int&gt; MPIII;
typedef map&lt;PII, bool&gt; MPIIB;

/** I/O Accelerator **/

/* ... :&quot; We are I/O Accelerator ... Use us at your own risk ;) ... &quot; .. */

template&lt;class T&gt; inline void RD(T &amp;);
template&lt;class T&gt; inline void OT(const T &amp;);

inline int RD(){ int x; RD(x); return x;}
template&lt;class T&gt; inline T&amp; _RD(T &amp;x){ RD(x); return x;}
inline void RC(char &amp;c){scanf(&quot; %c&quot;, &amp;c);}
inline void RS(char *s){scanf(&quot;%s&quot;, s);}

template&lt;class T0, class T1&gt; inline void RD(T0 &amp;x0, T1 &amp;x1){RD(x0), RD(x1);}
template&lt;class T0, class T1, class T2&gt; inline void RD(T0 &amp;x0, T1 &amp;x1, T2 &amp;x2){RD(x0), RD(x1), RD(x2);}
template&lt;class T0, class T1, class T2, class T3&gt; inline void RD(T0 &amp;x0, T1 &amp;x1, T2 &amp;x2, T3 &amp;x3){RD(x0), RD(x1), RD(x2), RD(x3);}
template&lt;class T0, class T1, class T2, class T3, class T4&gt; inline void RD(T0 &amp;x0, T1 &amp;x1, T2 &amp;x2, T3 &amp;x3, T4 &amp;x4){RD(x0), RD(x1), RD(x2), RD(x3), RD(x4);}
template&lt;class T0, class T1, class T2, class T3, class T4, class T5&gt; inline void RD(T0 &amp;x0, T1 &amp;x1, T2 &amp;x2, T3 &amp;x3, T4 &amp;x4, T5 &amp;x5){RD(x0), RD(x1), RD(x2), RD(x3), RD(x4), RD(x5);}
template&lt;class T0, class T1, class T2, class T3, class T4, class T5, class T6&gt; inline void RD(T0 &amp;x0, T1 &amp;x1, T2 &amp;x2, T3 &amp;x3, T4 &amp;x4, T5 &amp;x5, T6 &amp;x6){RD(x0), RD(x1), RD(x2), RD(x3), RD(x4), RD(x5), RD(x6);}
template&lt;class T0, class T1&gt; inline void OT(T0 &amp;x0, T1 &amp;x1){OT(x0), OT(x1);}
template&lt;class T0, class T1, class T2&gt; inline void OT(T0 &amp;x0, T1 &amp;x1, T2 &amp;x2){OT(x0), OT(x1), OT(x2);}
template&lt;class T0, class T1, class T2, class T3&gt; inline void OT(T0 &amp;x0, T1 &amp;x1, T2 &amp;x2, T3 &amp;x3){OT(x0), OT(x1), OT(x2), OT(x3);}
template&lt;class T0, class T1, class T2, class T3, class T4&gt; inline void OT(T0 &amp;x0, T1 &amp;x1, T2 &amp;x2, T3 &amp;x3, T4 &amp;x4){OT(x0), OT(x1), OT(x2), OT(x3), OT(x4);}
template&lt;class T0, class T1, class T2, class T3, class T4, class T5&gt; inline void OT(T0 &amp;x0, T1 &amp;x1, T2 &amp;x2, T3 &amp;x3, T4 &amp;x4, T5 &amp;x5){OT(x0), OT(x1), OT(x2), OT(x3), OT(x4), OT(x5);}
template&lt;class T0, class T1, class T2, class T3, class T4, class T5, class T6&gt; inline void OT(T0 &amp;x0, T1 &amp;x1, T2 &amp;x2, T3 &amp;x3, T4 &amp;x4, T5 &amp;x5, T6 &amp;x6){OT(x0), OT(x1), OT(x2), OT(x3), OT(x4), OT(x5), OT(x6);}

template&lt;class T&gt; inline void RST(T &amp;A){memset(A, 0, sizeof(A));}
template&lt;class T0, class T1&gt; inline void RST(T0 &amp;A0, T1 &amp;A1){RST(A0), RST(A1);}
template&lt;class T0, class T1, class T2&gt; inline void RST(T0 &amp;A0, T1 &amp;A1, T2 &amp;A2){RST(A0), RST(A1), RST(A2);}
template&lt;class T0, class T1, class T2, class T3&gt; inline void RST(T0 &amp;A0, T1 &amp;A1, T2 &amp;A2, T3 &amp;A3){RST(A0), RST(A1), RST(A2), RST(A3);}
template&lt;class T0, class T1, class T2, class T3, class T4&gt; inline void RST(T0 &amp;A0, T1 &amp;A1, T2 &amp;A2, T3 &amp;A3, T4 &amp;A4){RST(A0), RST(A1), RST(A2), RST(A3), RST(A4);}
template&lt;class T0, class T1, class T2, class T3, class T4, class T5&gt; inline void RST(T0 &amp;A0, T1 &amp;A1, T2 &amp;A2, T3 &amp;A3, T4 &amp;A4, T5 &amp;A5){RST(A0), RST(A1), RST(A2), RST(A3), RST(A4), RST(A5);}
template&lt;class T0, class T1, class T2, class T3, class T4, class T5, class T6&gt; inline void RST(T0 &amp;A0, T1 &amp;A1, T2 &amp;A2, T3 &amp;A3, T4 &amp;A4, T5 &amp;A5, T6 &amp;A6){RST(A0), RST(A1), RST(A2), RST(A3), RST(A4), RST(A5), RST(A6);}

template&lt;class T&gt; inline void CLR(T &amp;A){A.clear();}
template&lt;class T0, class T1&gt; inline void CLR(T0 &amp;A0, T1 &amp;A1){CLR(A0), CLR(A1);}
template&lt;class T0, class T1, class T2&gt; inline void CLR(T0 &amp;A0, T1 &amp;A1, T2 &amp;A2){CLR(A0), CLR(A1), CLR(A2);}
template&lt;class T0, class T1, class T2, class T3&gt; inline void CLR(T0 &amp;A0, T1 &amp;A1, T2 &amp;A2, T3 &amp;A3){CLR(A0), CLR(A1), CLR(A2), CLR(A3);}
template&lt;class T0, class T1, class T2, class T3, class T4&gt; inline void CLR(T0 &amp;A0, T1 &amp;A1, T2 &amp;A2, T3 &amp;A3, T4 &amp;A4){CLR(A0), CLR(A1), CLR(A2), CLR(A3), CLR(A4);}
template&lt;class T0, class T1, class T2, class T3, class T4, class T5&gt; inline void CLR(T0 &amp;A0, T1 &amp;A1, T2 &amp;A2, T3 &amp;A3, T4 &amp;A4, T5 &amp;A5){CLR(A0), CLR(A1), CLR(A2), CLR(A3), CLR(A4), CLR(A5);}
template&lt;class T0, class T1, class T2, class T3, class T4, class T5, class T6&gt; inline void CLR(T0 &amp;A0, T1 &amp;A1, T2 &amp;A2, T3 &amp;A3, T4 &amp;A4, T5 &amp;A5, T6 &amp;A6){CLR(A0), CLR(A1), CLR(A2), CLR(A3), CLR(A4), CLR(A5), CLR(A6);}
template&lt;class T&gt; inline void CLR(T &amp;A, int n){REP(i, n) CLR(A[i]);}
template&lt;class T&gt; inline void FLC(T &amp;A, int x){memset(A, x, sizeof(A));}
template&lt;class T0, class T1&gt; inline void FLC(T0 &amp;A0, T1 &amp;A1, int x){FLC(A0, x), FLC(A1, x);}
template&lt;class T0, class T1, class T2&gt; inline void FLC(T0 &amp;A0, T1 &amp;A1, T2 &amp;A2){FLC(A0), FLC(A1), FLC(A2);}
template&lt;class T0, class T1, class T2, class T3&gt; inline void FLC(T0 &amp;A0, T1 &amp;A1, T2 &amp;A2, T3 &amp;A3){FLC(A0), FLC(A1), FLC(A2), FLC(A3);}
template&lt;class T0, class T1, class T2, class T3, class T4&gt; inline void FLC(T0 &amp;A0, T1 &amp;A1, T2 &amp;A2, T3 &amp;A3, T4 &amp;A4){FLC(A0), FLC(A1), FLC(A2), FLC(A3), FLC(A4);}
template&lt;class T0, class T1, class T2, class T3, class T4, class T5&gt; inline void FLC(T0 &amp;A0, T1 &amp;A1, T2 &amp;A2, T3 &amp;A3, T4 &amp;A4, T5 &amp;A5){FLC(A0), FLC(A1), FLC(A2), FLC(A3), FLC(A4), FLC(A5);}
template&lt;class T0, class T1, class T2, class T3, class T4, class T5, class T6&gt; inline void FLC(T0 &amp;A0, T1 &amp;A1, T2 &amp;A2, T3 &amp;A3, T4 &amp;A4, T5 &amp;A5, T6 &amp;A6){FLC(A0), FLC(A1), FLC(A2), FLC(A3), FLC(A4), FLC(A5), FLC(A6);}

template&lt;class T&gt; inline void SRT(T &amp;A){sort(ALL(A));}
template&lt;class T, class C&gt; inline void SRT(T &amp;A, C B){sort(ALL(A), B);}

/** Add - On **/

const int MOD = 1000000007;
const int INF = 10009;
const DB EPS = 1e-9;
const DB OO = 1e15;
const DB PI = 3.14159265358979323846264;//M_PI;

// &lt;&lt;= ` 0. Daily Use .,

template&lt;class T&gt; inline void checkMin(T &amp;a,const T b){if (b&lt;a) a=b;}
template&lt;class T&gt; inline void checkMax(T &amp;a,const T b){if (b&gt;a) a=b;}
template&lt;class T, class C&gt; inline void checkMin(T&amp; a, const T b, C c){if (c(b,a)) a = b;}
template&lt;class T, class C&gt; inline void checkMax(T&amp; a, const T b, C c){if (c(a,b)) a = b;}
template&lt;class T&gt; inline T min(T a, T b, T c){return min(min(a, b), c);}
template&lt;class T&gt; inline T max(T a, T b, T c){return max(max(a, b), c);}
template&lt;class T&gt; inline T min(T a, T b, T c, T d){return min(min(a, b), min(c, d));}
template&lt;class T&gt; inline T sqr(T a){return a*a;}
template&lt;class T&gt; inline T cub(T a){return a*a*a;}
int Ceil(int x, int y){return (x - 1) / y + 1;}

// &lt;&lt;= '9. Comutational Geometry .,

struct Po; struct Line; struct Seg;

inline int sgn(DB x){return x &lt; -EPS ? -1 : x &gt; EPS;}
inline int sgn(DB x, DB y){return sgn(x - y);}

struct Po{
    DB x, y;
    Po(DB _x = 0, DB _y = 0):x(_x), y(_y){}

    friend istream&amp; operator &gt;&gt;(istream&amp; in, Po &amp;p){return in &gt;&gt; p.x &gt;&gt; p.y;}
    friend ostream&amp; operator &lt;&lt;(ostream&amp; out, Po p){return out &lt;&lt; &quot;(&quot; &lt;&lt; p.x &lt;&lt; &quot;, &quot; &lt;&lt; p.y &lt;&lt; &quot;)&quot;;}

    friend bool operator ==(Po, Po);
    friend bool operator !=(Po, Po);
    friend Po operator +(Po, Po);
    friend Po operator -(Po, Po);
    friend Po operator *(Po, DB);
    friend Po operator /(Po, DB);

    bool operator &lt; (const Po &amp;rhs) const{return sgn(x, rhs.x) &lt; 0 || sgn(x, rhs.x) == 0 &amp;&amp; sgn(y, rhs.y) &lt; 0;}
    Po&amp; operator +=(Po rhs){x += rhs.x, y += rhs.y;}
    Po&amp; operator -=(Po rhs){x -= rhs.x, y -= rhs.y;}
    Po&amp; operator *=(DB k){x *= k, y *= k;}
    Po&amp; operator /=(DB k){x /= k, y /= k;}

    DB length_sqr(){return sqr(x) + sqr(y);}
    DB length(){return sqrt(length_sqr());}

    DB atan(){
        return atan2(y, x);
    }

    void input(){
        scanf(&quot;%lf %lf&quot;, &amp;x, &amp;y);
    }
};

bool operator ==(Po a, Po b){return sgn(a.x - b.x) == 0 &amp;&amp; sgn(a.y - b.y) == 0;}
bool operator !=(Po a, Po b){return sgn(a.x - b.x) != 0 || sgn(a.y - b.y) != 0;}
Po operator +(Po a, Po b){return Po(a.x + b.x, a.y + b.y);}
Po operator -(Po a, Po b){return Po(a.x - b.x, a.y - b.y);}
Po operator *(Po a, DB k){return Po(a.x * k, a.y * k);}
Po operator /(Po a, DB k){return Po(a.x / k, a.y / k);}

struct Line{
    Po a, b;
    Line(Po _a = Po(), Po _b = Po()):a(_a), b(_b){}
    Line(DB x0, DB y0, DB x1, DB y1):a(Po(x0, y0)), b(Po(x1, y1)){}
    Line(Seg);

    friend ostream&amp; operator &lt;&lt;(ostream&amp; out, Line p){return out &lt;&lt; p.a &lt;&lt; &quot;-&quot; &lt;&lt; p.b;}
};

struct Seg{
    Po a, b;
    Seg(Po _a = Po(), Po _b = Po()):a(_a), b(_b){}
    Seg(DB x0, DB y0, DB x1, DB y1):a(Po(x0, y0)), b(Po(x1, y1)){}
    Seg(Line l);

    friend ostream&amp; operator &lt;&lt;(ostream&amp; out, Seg p){return out &lt;&lt; p.a &lt;&lt; &quot;-&quot; &lt;&lt; p.b;}
    DB length(){return (b - a).length();}
};

Line::Line(Seg l):a(l.a), b(l.b){}
Seg::Seg(Line l):a(l.a), b(l.b){}

#define innerProduct dot
#define scalarProduct dot
#define dotProduct dot
#define outerProduct det
#define crossProduct det

inline DB dot(DB x1, DB y1, DB x2, DB y2){return x1 * x2 + y1 * y2;}
inline DB dot(Po a, Po b){return dot(a.x, b.y, b.x, b.y);}
inline DB dot(Po p0, Po p1, Po p2){return dot(p1 - p0, p2 - p0);}
inline DB dot(Line l1, Line l2){return dot(l1.b - l1.a, l2.b - l2.a);}
inline DB det(DB x1, DB y1, DB x2, DB y2){return x1 * y2 - x2 * y1;}
inline DB det(Po a, Po b){return det(a.x, a.y, b.x, b.y);}
inline DB det(Po p0, Po p1, Po p2){return det(p1 - p0, p2 - p0);}
inline DB det(Line l1, Line l2){return det(l1.b - l1.a, l2.b - l2.a);}

template&lt;class T1, class T2&gt; inline DB dist(T1 x, T2 y){return sqrt(dist_sqr(x, y));}

inline DB dist_sqr(Po a, Po b){return sqr(a.x - b.x) + sqr(a.y - b.y);}
inline DB dist_sqr(Po p, Line l){Po v0 = l.b - l.a, v1 = p - l.a; return sqr(fabs(det(v0, v1))) / v0.length_sqr();}
inline DB dist_sqr(Po p, Seg l){
    Po v0 = l.b - l.a, v1 = p - l.a, v2 = p - l.b;
    if (sgn(dot(v0, v1)) * sgn(dot(v0, v2)) &lt;= 0) return dist_sqr(p, Line(l));
    else return min(v1.length_sqr(), v2.length_sqr());
}

inline DB dist_sqr(Line l, Po p){
    return dist_sqr(p, l);
}

inline DB dist_sqr(Line l1, Line l2){
    if (sgn(det(l1, l2)) != 0) return 0;
    return dist_sqr(l1.a, l2);
}
inline DB dist_sqr(Line l1, Seg l2){
    Po v0 = l1.b - l1.a, v1 = l2.a - l1.a, v2 = l2.b - l1.a; DB c1 = det(v0, v1), c2 = det(v0, v2);
    return sgn(c1) != sgn(c2) ? 0 : sqr(min(fabs(c1), fabs(c2))) / v0.length_sqr();
}

bool isIntersect(Seg l1, Seg l2){

    //if (l1.a == l2.a || l1.a == l2.b || l1.b == l2.a || l1.b == l2.b) return true;

    return
        min(l1.a.x, l1.b.x) &lt;= max(l2.a.x, l2.b.x) &amp;&amp;
        min(l2.a.x, l2.b.x) &lt;= max(l1.a.x, l1.b.x) &amp;&amp;
        min(l1.a.y, l1.b.y) &lt;= max(l2.a.y, l2.b.y) &amp;&amp;
        min(l2.a.y, l2.b.y) &lt;= max(l1.a.y, l1.b.y) &amp;&amp;
    sgn( det(l1.a, l2.a, l2.b) ) * sgn( det(l1.b, l2.a, l2.b) ) &lt;= 0 &amp;&amp;
    sgn( det(l2.a, l1.a, l1.b) ) * sgn( det(l2.b, l1.a, l1.b) ) &lt;= 0;

}

inline DB dist_sqr(Seg l1, Seg l2){
    if (isIntersect(l1, l2)) return 0;
    else return min(dist_sqr(l1.a, l2), dist_sqr(l1.b, l2), dist_sqr(l2.a, l1), dist_sqr(l2.b, l1));
}

inline bool isOnExtremePoint(const Po &amp;p, const Seg &amp;l){
    return p == l.a || p == l.b;
}

inline bool isOnseg(const Po &amp;p, const Seg &amp;l){

    //if (p == l.a || p == l.b) return false;

    return sgn(det(p, l.a, l.b)) == 0 &amp;&amp;
        sgn(l.a.x, p.x) * sgn(l.b.x, p.x) &lt;= 0 &amp;&amp; sgn(l.a.y, p.y) * sgn(l.b.y, p.y) &lt;= 0;
}

inline Po intersect(const Line &amp;l1, const Line &amp;l2){
    return l1.a + (l1.b - l1.a) * (det(l2.a, l1.a, l2.b) / det(l2, l1));
}

// perpendicular foot
inline Po intersect(const Po &amp; p, const Line &amp;l){
    return intersect(Line(p, p + Po(l.a.y - l.b.y, l.b.x - l.a.x)), l);
}

inline Po rotate(Po p, DB alpha, Po o = Po()){
    p.x -= o.x, p.y -= o .y;
    return Po(p.x * cos(alpha) - p.y * sin(alpha), p.y * cos(alpha) + p.x * sin(alpha)) + o;
}

struct Circle{
    Po o; DB r;

    Circle(){}
    Circle(Po _o, DB _r):o(_o), r(_r){}

    void input(){
        o.input(); scanf(&quot;%lf&quot;, &amp;r);
    }
    void output(){
        printf(&quot;%.2lf %.2lf %.2lf\n&quot;, o.x, o.y, r);
    }
    bool tttest(Po p){
        return sgn(dist_sqr(o, p), sqr(r)) &lt;= 0;
    }
};

// &lt;&lt;= ' 0. I/O Accelerator interface .,

template&lt;class T&gt; inline void RD(T &amp;x){
    //cin &gt;&gt; x;
    scanf(&quot;%d&quot;, &amp;x);
    //char c; for (c = getchar(); c &lt; '0'; c = getchar()); x = c - '0'; for (c = getchar(); c &gt;= '0'; c = getchar()) x = x * 10 + c - '0';
    //char c; c = getchar(); x = c - '0'; for (c = getchar(); c &gt;= '0'; c = getchar()) x = x * 10 + c - '0';
}

int ____Case;
template&lt;class T&gt; inline void OT(const T &amp;x){
    printf(&quot;Case #%d: &quot;, ++____Case);
    //printf(&quot;%d&quot;, x);
    printf(&quot;%.9f&quot;, x);
    puts(&quot;&quot;);
}

/* .................................................................................................................................. */

vector&lt;Po&gt; P;
int n;

inline Po Center(const Po&amp; p0, const Po&amp; p1){
    return (p0 + p1) / 2;
}

inline Po Excenter(const Po&amp; p0, const Po&amp; p1, const Po&amp; p2){
    Po v1 = p1 - p0, v2 = p2 - p0; DB s1 = v1.length_sqr() / 2, s2 = v2.length_sqr() / 2, d = det(v1, v2);
    return Po(s1*v2.y-s2*v1.y, s2*v1.x-s1*v2.x)/d + p0;
}

inline Po Excenter2(Po p0, Po p1, Po p2){
    Po m1 = (p0 + p1) / 2, m2 = (p0 + p2) / 2;
    Line l1(m1, Po(m1.x - p0.y + p1.y, m1.y + p0.x - p1.x)) , l2(m2, Po(m2.x - p0.y + p2.y, m2.y + p0.x - p2.x));
    return intersect(l1, l2);
}

// minimal_cover_circle
Circle checkItOut(vector&lt;Po&gt;&amp; P){
    random_shuffle(ALL(P));

    Circle C(P[0], 0); FOR(i, 1, n) if (!C.tttest(P[i])){
        C = Circle(P[i], 0); REP(j, i) if (!C.tttest(P[j])){
            C.o = Center(P[i], P[j]), C.r = dist(C.o, P[j]);
            REP(k, j) if (!C.tttest(P[k])){
                C.o = Excenter(P[i], P[j], P[k]), C.r = dist(C.o, P[k]);
            }
        }
    }

    return C;
}

int main(){

    //freopen(&quot;in.txt&quot;, &quot;r&quot;, stdin);
    //freopen(&quot;out.txt&quot;, &quot;w&quot;, stdout);

    while (scanf(&quot;%d&quot;, &amp;n) != EOF &amp;&amp; n){
        P.resize(n); REP(i, n) P[i].input();
        checkItOut(P).output();
    }

}
</pre>
<h3>External link: </h3>
<p><a href="http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=450">http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=450</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.shuizilong.com/house/archives/zoj-1450-minimal-circle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Code Jam 2012 Round 1A</title>
		<link>http://www.shuizilong.com/house/archives/google-code-jam-2012-round-1a/</link>
		<comments>http://www.shuizilong.com/house/archives/google-code-jam-2012-round-1a/#comments</comments>
		<pubDate>Sat, 28 Apr 2012 03:50:04 +0000</pubDate>
		<dc:creator>xiaodao</dc:creator>
				<category><![CDATA[Google Code Jam]]></category>

		<guid isPermaLink="false">http://www.shuizilong.com/house/?p=194</guid>
		<description><![CDATA[Brief description: Problem C. Cruise Control 给定一条无限长的双车道的单行道，n 量车的信息 (Li, Si, Pi) 表示初始在哪个车道、速度、和当前位置， 问第一次发生碰撞事件的时间。(每辆车车长 5m，车辆在旁边没有车时，可以任意切换车道且不计时间。) &#8230; Analysis: Problem C. Cruise Control 对每辆车可能的相遇区间选取关键时间建立事件，排序。。。 。。之后 用并查集 暴力维护染色信息即可 （。。其实就是有一些点已经染色的情况下做二分图判定。。并查集貌似会比较麻烦。。因为有拆解的情况产生呀。。。） &#8230;]]></description>
			<content:encoded><![CDATA[<h3>Brief description: </h3>
<p>Problem C. Cruise Control<br />
给定一条无限长的双车道的单行道，n 量车的信息 (Li, Si, Pi) 表示初始在哪个车道、速度、和当前位置，<br />
问第一次发生碰撞事件的时间。(每辆车车长 5m，车辆在旁边没有车时，可以任意切换车道且不计时间。)<br />
&#8230;<br />
<span id="more-194"></span></p>
<h3>Analysis: </h3>
<p>Problem C. Cruise Control<br />
对每辆车可能的相遇区间选取关键时间建立事件，排序。。。<br />
。。之后 <del datetime="2012-04-28T11:57:10+00:00">用并查集</del> 暴力维护染色信息即可<br />
（。。其实就是有一些点已经染色的情况下做二分图判定。。并查集貌似会比较麻烦。。因为有拆解的情况产生呀。。。）<br />
&#8230;</p>
<pre class="brush: cpp; light: false; title: Problem A. Password Problem; toolbar: true; notranslate">
// &lt;&lt;= ' 0. I/O Accelerator interface .,

template&lt;class T&gt; inline void RD(T &amp;x){
    //cin &gt;&gt; x;
    scanf(&quot;%d&quot;, &amp;x);
    //char c; for (c = getchar(); c &lt; '0'; c = getchar()); x = c - '0'; for (c = getchar(); c &gt;= '0'; c = getchar()) x = x * 10 + c - '0';
    //char c; c = getchar(); x = c - '0'; for (c = getchar(); c &gt;= '0'; c = getchar()) x = x * 10 + c - '0';
}

int ____Case;
template&lt;class T&gt; inline void OT(const T &amp;x){
    printf(&quot;Case #%d: &quot;, ++____Case);
    //printf(&quot;%d&quot;, x);
    printf(&quot;%.9f&quot;, x);
    puts(&quot;&quot;);
}

/* .................................................................................................................................. */

const int N = 100009;
DB P[N], tmp, res, cur;
int A, B;

int main(){

    //freopen(&quot;A-small-attempt0.in&quot;, &quot;r&quot;, stdin);
    freopen(&quot;A-large.in&quot;, &quot;r&quot;, stdin);
    //freopen(&quot;in.txt&quot;, &quot;r&quot;, stdin);
    freopen(&quot;out.txt&quot;, &quot;w&quot;, stdout);

    Rush{
        RD(A, B); REP(i, A) scanf(&quot;%lf&quot;, &amp;P[i]); res = OO;

        res = B + 2, tmp = 1;
        DWN_1(i, A, 0){
            cur = (DB) (2 * i + B - A + 1 + B + 1) - tmp * (B + 1);
            checkMin(res, cur);
            tmp *= P[A - i];
        }

        OT(res);
    }
}
</pre>
<pre class="brush: cpp; light: false; title: Problem B. Kingdom Rush; toolbar: true; notranslate">
// &lt;&lt;= ' 0. I/O Accelerator interface .,

template&lt;class T&gt; inline void RD(T &amp;x){
    //cin &gt;&gt; x;
    scanf(&quot;%d&quot;, &amp;x);
    //char c; for (c = getchar(); c &lt; '0'; c = getchar()); x = c - '0'; for (c = getchar(); c &gt;= '0'; c = getchar()) x = x * 10 + c - '0';
    //char c; c = getchar(); x = c - '0'; for (c = getchar(); c &gt;= '0'; c = getchar()) x = x * 10 + c - '0';
}

bool failed;

int ____Case;
template&lt;class T&gt; inline void OT(const T &amp;x){
    printf(&quot;Case #%d: &quot;, ++____Case);
    if (failed) puts(&quot;Too Bad&quot;);
    else {
        printf(&quot;%d&quot;, x); puts(&quot;&quot;);
    }
}

/* .................................................................................................................................. */

const int N = 1009;
int a[N], b[N], c[N], star, tt;
int n;

int main(){

    //freopen(&quot;B-large-practice.in&quot;, &quot;r&quot;, stdin);
    //freopen(&quot;A-large.in&quot;, &quot;r&quot;, stdin);
    freopen(&quot;in.txt&quot;, &quot;r&quot;, stdin);
    freopen(&quot;out.txt&quot;, &quot;w&quot;, stdout);

    Rush{

        REP_C(i, _RD(n)) RD(a[i], b[i]); b[n] = -INF;

        int j; RST(c); failed = false; star = tt = 0; while (star &lt; 2*n &amp;&amp; !failed){

            ++tt;

            REP(i, n) if (c[i] &lt; 2 &amp;&amp; star &gt;= b[i]){
                star += 2 - c[i], c[i] = 2;
                goto A;
            }

            j = n; REP(i, n) if (c[i] &lt; 1 &amp;&amp; star &gt;= a[i]){
                if (b[i] &gt; b[j]) j = i;
            }

            if (j != n){
                star += 1, c[j] = 1;
                goto A;
            }

            failed = true;
            A:;
        }

        OT(tt);
    }
}
</pre>
<pre class="brush: cpp; light: false; title: Problem C. Cruise Control; toolbar: true; notranslate">
const int N = 59;

bool G[N][N]; int lane[N], pos[N], spd[N], tmp[N];
int n;

bool dfs(int u, int c) {
    if (lane[u] &amp;&amp; lane[u] != c) return false;
    if (tmp[u]) return tmp[u] == c;

    tmp[u] = c; REP(v, n){
        if (G[u][v] &amp;&amp; !dfs(v, c * -1)) return false;
    }
    return true;
}

vector&lt;DB&gt; L;

int main() {

    //freopen(&quot;C-small-practice.in&quot;, &quot;r&quot;, stdin);
    freopen(&quot;C-large-practice.in&quot;, &quot;r&quot;, stdin);
    //freopen(&quot;in.txt&quot;, &quot;r&quot;, stdin);
    freopen(&quot;out.txt&quot;, &quot;w&quot;, stdout);

    Rush{

        CLR(L); L.PB(0);

        char dir; REP_C(i, _RD(n)){
            lane[i] = _RC(dir) == 'L' ? -1 : 1;
            RD(spd[i], pos[i]);
        }

        REP(i, n) REP(j, n) if (spd[j] &gt; spd[i]){
            DB speed = spd[j] - spd[i]; if (pos[i] + 5 &gt; pos[j]) {
                L.PB(DB(pos[i]+5-pos[j])/speed);
                if (pos[i] &gt; pos[j]) {
                    L.PB(DB(pos[i]-pos[j])/speed);
                    if (pos[i] - 5 &gt; pos[j]) L.PB(DB(pos[i]-5-pos[j])/speed);
                }
            }
        }

        res = 0; SRT(L); RST(G); int ii; REP_N(ii, SZ(L)){

                REP(i, n){
                    bool coll = false; REP(j, n) if (j != i) {
                    DB pi = pos[i] + spd[i] * L[ii], pj = pos[j] + spd[j] * L[ii];
                    if (sgn(abs(pi - pj), 5) &lt; 0){
                        G[i][j] = G[j][i] = true;
                        coll = true;
                    }
                }

                if (!coll) {
                    for (int j = 0; j &lt; N; j++) G[i][j] = G[j][i] = 0;
                    lane[i] = 0;
                }
            }

            REP(i, n) if (!lane[i]){
                RST(tmp); bool lv = dfs(i, -1);
                RST(tmp); bool rv = dfs(i, 1);

                if (!lv &amp;&amp; !rv) goto Done;
                if (!lv &amp;&amp; rv) lane[i] = 1;
                if (lv &amp;&amp; !rv) lane[i] = -1;
            }
            else {
                RST(tmp); if (!dfs(i, lane[i])) goto Done;
            }

            res = L[ii];
        }

Done:
        printf(&quot;Case #%d: &quot;, ++____Case);
        if (ii == SZ(L)) puts(&quot;Possible&quot;);
        else printf(&quot;%.9lf\n&quot;, res);
    }
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.shuizilong.com/house/archives/google-code-jam-2012-round-1a/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SRM 481</title>
		<link>http://www.shuizilong.com/house/archives/srm-481/</link>
		<comments>http://www.shuizilong.com/house/archives/srm-481/#comments</comments>
		<pubDate>Mon, 23 Apr 2012 20:38:00 +0000</pubDate>
		<dc:creator>xiaodao</dc:creator>
				<category><![CDATA[日常]]></category>

		<guid isPermaLink="false">http://www.shuizilong.com/house/?p=192</guid>
		<description><![CDATA[Brief description: DIV 1 1000 XorLife： 群众喜闻乐见的生命游戏，如标题字面上的意思，每一个 Live 格子下一秒将改变其自身和周围共 5 个格子的状态。 （。。无限平面，初始培养皿大小 50 × 50 &#8230; 时间 K ≤ 1,000,000,000 ..） Analysis:]]></description>
			<content:encoded><![CDATA[<h3>Brief description: </h3>
<p>DIV 1 1000 XorLife：<br />
群众喜闻乐见的生命游戏，如标题字面上的意思，每一个 Live 格子下一秒将改变其自身和周围共 5 个格子的状态。<br />
（。。无限平面，初始培养皿大小 50 × 50 &#8230; 时间 K ≤ 1,000,000,000 ..）</p>
<p><span id="more-192"></span></p>
<h3>Analysis: </h3>
<pre class="brush: cpp; light: false; title: ; toolbar: true; notranslate">
/* &amp;*#()&amp;*#)&amp;E*F&amp; */

#include &lt;iostream&gt;
#include &lt;cstdio&gt;
#include &lt;cstring&gt;
#include &lt;ctime&gt;
#include &lt;cmath&gt;
#include &lt;algorithm&gt;
#include &lt;sstream&gt;
#include &lt;string&gt;
#include &lt;vector&gt;
#include &lt;map&gt;

using namespace std;

#define REP(i, n) for (int i=0;i&lt;int(n);++i)
#define FOR(i, a, b) for (int i=int(a);i&lt;int(b);++i)
#define DWN(i, b, a) for (int i=int(b-1);i&gt;=int(a);--i)
#define REP_1(i, n) for (int i=1;i&lt;=int(n);++i)
#define FOR_1(i, a, b) for (int i=int(a);i&lt;=int(b);++i)
#define DWN_1(i, b, a) for (int i=int(b);i&gt;=int(a);--i)
#define REP_C(i, n) for (int n____=int(n),i=0;i&lt;n____;++i)
#define FOR_C(i, a, b) for (int b____=int(b),i=a;i&lt;b____;++i)
#define DWN_C(i, b, a) for (int a____=int(a),i=b-1;i&gt;=a____;--i)
#define REP_N(i, n) for (i=0;i&lt;int(n);++i)
#define FOR_N(i, a, b) for (i=int(a);i&lt;int(b);++i)
#define DWN_N(i, b, a) for (i=int(b-1);i&gt;=int(a);--i)
#define REP_1_C(i, n) for (int n____=int(n),i=1;i&lt;=n____;++i)
#define FOR_1_C(i, a, b) for (int b____=int(b),i=a;i&lt;=b____;++i)
#define DWN_1_C(i, b, a) for (int a____=int(a),i=b;i&gt;=a____;--i)
#define REP_1_N(i, n) for (i=1;i&lt;=int(n);++i)
#define FOR_1_N(i, a, b) for (i=int(a);i&lt;=int(b);++i)
#define DWN_1_N(i, b, a) for (i=int(b);i&gt;=int(a);--i)
#define REP_C_N(i, n) for (n____=int(n),i=0;i&lt;n____;++i)
#define FOR_C_N(i, a, b) for (b____=int(b),i=a;i&lt;b____;++i)
#define DWN_C_N(i, b, a) for (a____=int(a),i=b-1;i&gt;=a____;--i)
#define REP_1_C_N(i, n) for (n____=int(n),i=1;i&lt;=n____;++i)
#define FOR_1_C_N(i, a, b) for (b____=int(b),i=a;i&lt;=b____;++i)
#define DWN_1_C_N(i, b, a) for (a____=int(a),i=b;i&gt;=a____;--i)

#define ECH(it, A) for (typeof(A.begin()) it=A.begin(); it != A.end(); ++it)
#define DO(n) while(n--)
#define DO_C(n) int n____ = n; while(n____--)
#define TO(i, a, b) int s_=a&lt;b?1:-1,b_=b+s_;for(int i=a;i!=b_;i+=s_)
#define TO_1(i, a, b) int s_=a&lt;b?1:-1,b_=b;for(int i=a;i!=b_;i+=s_)
#define SQZ(i, j, a, b) for (int i=int(a),j=int(b)-1;i&lt;j;++i,--j)
#define SQZ_1(i, j, a, b) for (int i=int(a),j=int(b);i&lt;=j;++i,--j)
#define REP_2(i, j, n, m) REP(i, n) REP(j, m)
#define REP_2_1(i, j, n, m) REP_1(i, n) REP_1(j, m)

#define ALL(A) A.begin(), A.end()
#define CLR(A) A.clear()
#define CPY(A, B) memcpy(A, B, sizeof(A))
#define INS(A, P, B) A.insert(A.begin() + P, B)
#define ERS(A, P) A.erase(A.begin() + P)
#define SRT(A) sort(ALL(A))
#define SZ(A) int(A.size())
#define PB push_back
#define MP(A, B) make_pair(A, B)

typedef long long LL;
typedef double DB;

template&lt;class T&gt; inline void RST(T &amp;A){memset(A, 0, sizeof(A));}
template&lt;class T&gt; inline void FLC(T &amp;A, int x){memset(A, x, sizeof(A));}

// &lt;&lt;= ` 0. Daily Use .,

template&lt;class T&gt; inline void checkMin(T &amp;a,const T b){if (b&lt;a) a=b;}
template&lt;class T&gt; inline void checkMax(T &amp;a,const T b){if (b&gt;a) a=b;}
template &lt;class T, class C&gt; inline void checkMin(T&amp; a, const T b, C c){if (c(b,a)) a = b;}
template &lt;class T, class C&gt; inline void checkMax(T&amp; a, const T b, C c){if (c(a,b)) a = b;}
template&lt;class T&gt; inline T min(T a, T b, T c){return min(min(a, b), c);}
template&lt;class T&gt; inline T max(T a, T b, T c){return max(max(a, b), c);}
template&lt;class T&gt; inline T min(T a, T b, T c, T d){return min(min(a, b), min(c, d));}
template&lt;class T&gt; inline T sqr(T a){return a*a;}
template&lt;class T&gt; inline T cub(T a){return a*a*a;}
int Ceil(int x, int y){return (x - 1) / y + 1;}

// &lt;&lt;= ` 1. Bitwise Operation .,

inline bool _1(int x, int i){return x &amp; 1&lt;&lt;i;}
inline int _1(int i){return 1&lt;&lt;i;}
inline int _U(int i){return _1(i) - 1;};

inline int count_bits(int x){
    x = (x &amp; 0x55555555) + ((x &amp; 0xaaaaaaaa) &gt;&gt; 1);
    x = (x &amp; 0x33333333) + ((x &amp; 0xcccccccc) &gt;&gt; 2);
    x = (x &amp; 0x0f0f0f0f) + ((x &amp; 0xf0f0f0f0) &gt;&gt; 4);
    x = (x &amp; 0x00ff00ff) + ((x &amp; 0xff00ff00) &gt;&gt; 8);
    x = (x &amp; 0x0000ffff) + ((x &amp; 0xffff0000) &gt;&gt; 16);
    return x;
}

template&lt;class T&gt; inline T low_bit(T x) {
    return x &amp; -x;
}

template&lt;class T&gt; inline T high_bit(T x) {
    T p = low_bit(x);
    while (p != x) x -= p, p = low_bit(x);
    return p;
}

/* -&amp;$&amp;#*( &amp;#*@)^$@&amp;*)*/

const int MOD = 1000000007;
const int INF = 0x7fffffff;

const int N = 50;

int dx[] = {0, 0, 0, 1, -1};
int dy[] = {0, 1, -1, 0, 0};

map&lt;pair&lt;int, int&gt;, int&gt; P, Q, _Q;

map&lt;pair&lt;int, int&gt;, int&gt; dir[39], tmp;

void Collision(map&lt;pair&lt;int, int&gt;, int&gt;&amp; A){
    for (map&lt;pair&lt;int, int&gt;, int&gt;::iterator it=A.begin(); it!=A.end();){
        if (!(it-&gt;second &amp;1)){
            map&lt;pair&lt;int, int&gt;, int&gt;::iterator jt = it; ++jt;
            A.erase(it); it = jt;
        }
        else {
            ++it;
        }
    }
}

class XorLife {
public:
	long long countAliveCells(vector &lt;string&gt; field, int K) {

        int n = SZ(field), m = SZ(field[0]); REP(i, 32) CLR(dir[i]);
        dir[0][MP(0, 0)] = 1, dir[0][MP(1, 0)] = 1, dir[0][MP(-1, 0)] = 1;
        dir[0][MP(0, 1)] = 1, dir[0][MP(0, -1)] = 1;

        FOR(i, 1, 32){
            tmp = dir[i-1]; ECH(it, tmp){
                int x = it-&gt;first.first, y = it-&gt;first.second;
                ECH(jt, dir[i-1]){
                    int xx = x + jt-&gt;first.first, yy = y + jt-&gt;first.second;
                    ++dir[i][MP(xx, yy)];
                }
            }

            ECH(it, dir[i]) if (!(it-&gt;second&amp;1)) dir[i].erase(it);
        }

        CLR(Q); REP(i, n) REP(j, m) if (field[i][j] == 'o'){
            ++Q[MP(i, j)];
        }

        if (Q.empty()) return 0;

        int i; FOR_N(i, 0, 32) if (_1(K, i)){

            cout &lt;&lt; i &lt;&lt; endl;

            CLR(P); ECH(it, Q){
                int x = it-&gt;first.first, y = it-&gt;first.second;
                ECH(jt, dir[i]){
                    int xx = x + jt-&gt;first.first, yy = y + jt-&gt;first.second;
                    ++P[MP(xx, yy)];
                }
            }

            Collision(P), Q = P;
        }
        else {
            if (i &gt; 8) break;
        }

        LL res = SZ(Q); CLR(Q); ++Q[MP(0, 0)];
        FOR_N(i, i+1, 32) if (_1(K, i)){
           CLR(P); ECH(it, Q){
                int x = it-&gt;first.first, y = it-&gt;first.second;
                ECH(jt, dir[i]){
                    int xx = x + jt-&gt;first.first, yy = y + jt-&gt;first.second;
                    ++P[MP(xx, yy)];
                }
            }

            Collision(P), Q = P;
        }
        else {
            res *= SZ(Q);
            CLR(Q); ++Q[MP(0, 0)];
        }

        return res;
	}
};

// BEGIN CUT HERE
namespace moj_harness {
	int run_test_case(int);
	void run_test(int casenum = -1, bool quiet = false) {
		if (casenum != -1) {
			if (run_test_case(casenum) == -1 &amp;&amp; !quiet) {
				cerr &lt;&lt; &quot;Illegal input! Test case &quot; &lt;&lt; casenum &lt;&lt; &quot; does not exist.&quot; &lt;&lt; endl;
			}
			return;
		}

		int correct = 0, total = 0;
		for (int i=0;; ++i) {
			int x = run_test_case(i);
			if (x == -1) {
				if (i &gt;= 100) break;
				continue;
			}
			correct += x;
			++total;
		}

		if (total == 0) {
			cerr &lt;&lt; &quot;No test cases run.&quot; &lt;&lt; endl;
		} else if (correct &lt; total) {
			cerr &lt;&lt; &quot;Some cases FAILED (passed &quot; &lt;&lt; correct &lt;&lt; &quot; of &quot; &lt;&lt; total &lt;&lt; &quot;).&quot; &lt;&lt; endl;
		} else {
			cerr &lt;&lt; &quot;All &quot; &lt;&lt; total &lt;&lt; &quot; tests passed!&quot; &lt;&lt; endl;
		}
	}

	int verify_case(int casenum, const long long &amp;expected, const long long &amp;received, clock_t elapsed) {
		cerr &lt;&lt; &quot;Example &quot; &lt;&lt; casenum &lt;&lt; &quot;... &quot;;

		string verdict;
		vector&lt;string&gt; info;
		char buf[100];

		if (elapsed &gt; CLOCKS_PER_SEC / 200) {
			sprintf(buf, &quot;time %.2fs&quot;, elapsed * (1.0/CLOCKS_PER_SEC));
			info.push_back(buf);
		}

		if (expected == received) {
			verdict = &quot;PASSED&quot;;
		} else {
			verdict = &quot;FAILED&quot;;
		}

		cerr &lt;&lt; verdict;
		if (!info.empty()) {
			cerr &lt;&lt; &quot; (&quot;;
			for (int i=0; i&lt;(int)info.size(); ++i) {
				if (i &gt; 0) cerr &lt;&lt; &quot;, &quot;;
				cerr &lt;&lt; info[i];
			}
			cerr &lt;&lt; &quot;)&quot;;
		}
		cerr &lt;&lt; endl;

		if (verdict == &quot;FAILED&quot;) {
			cerr &lt;&lt; &quot;    Expected: &quot; &lt;&lt; expected &lt;&lt; endl;
			cerr &lt;&lt; &quot;    Received: &quot; &lt;&lt; received &lt;&lt; endl;
		}

		return verdict == &quot;PASSED&quot;;
	}

	int run_test_case(int casenum) {
		switch (casenum) {
		case 0: {
			string field[]            = {&quot;.&quot;, &quot;.&quot;, &quot;.&quot;, &quot;.&quot;, &quot;.&quot;, &quot;o&quot;, &quot;.&quot;, &quot;o&quot;, &quot;.&quot;, &quot;o&quot;, &quot;.&quot;, &quot;o&quot;, &quot;.&quot;, &quot;.&quot;, &quot;.&quot;, &quot;.&quot;, &quot;.&quot;, &quot;.&quot;, &quot;o&quot;, &quot;o&quot;, &quot;.&quot;, &quot;.&quot;, &quot;.&quot;, &quot;.&quot;, &quot;o&quot;, &quot;.&quot;, &quot;.&quot;, &quot;o&quot;, &quot;.&quot;, &quot;.&quot;, &quot;o&quot;, &quot;.&quot;, &quot;.&quot;, &quot;.&quot;, &quot;o&quot;, &quot;.&quot;, &quot;.&quot;, &quot;.&quot;, &quot;o&quot;, &quot;o&quot;, &quot;.&quot;, &quot;.&quot;, &quot;o&quot;, &quot;.&quot;, &quot;.&quot;, &quot;.&quot;, &quot;.&quot;, &quot;.&quot;, &quot;o&quot;, &quot;.&quot;};
			int K                     = 8095;
			long long expected__      = 6199756;

			clock_t start__           = clock();
			long long received__      = XorLife().countAliveCells(vector &lt;string&gt;(field, field + (sizeof field / sizeof field[0])), K);
			return verify_case(casenum, expected__, received__, clock()-start__);
		}
		case 1: {
			string field[]            = {&quot;..&quot;
,&quot;..&quot;};
			int K                     = 23;
			long long expected__      = 0;

			clock_t start__           = clock();
			long long received__      = XorLife().countAliveCells(vector &lt;string&gt;(field, field + (sizeof field / sizeof field[0])), K);
			return verify_case(casenum, expected__, received__, clock()-start__);
		}
		case 2: {
			string field[]            = {&quot;o&quot;};
			int K                     = 1234567;
			long long expected__      = 11018125;

			clock_t start__           = clock();
			long long received__      = XorLife().countAliveCells(vector &lt;string&gt;(field, field + (sizeof field / sizeof field[0])), K);
			return verify_case(casenum, expected__, received__, clock()-start__);
		}
		case 3: {
			string field[]            = {&quot;o.oo.ooo&quot;
,&quot;o.o.o.oo&quot;
,&quot;ooo.oooo&quot;
,&quot;o.o..o.o&quot;
,&quot;o.o..o.o&quot;
,&quot;o..oooo.&quot;
,&quot;..o.o.oo&quot;
,&quot;oo.ooo.o&quot;};
			int K                     = (1&lt;&lt;31)-1;
			long long expected__      = 447104494375LL;

			clock_t start__           = clock();
			long long received__      = XorLife().countAliveCells(vector &lt;string&gt;(field, field + (sizeof field / sizeof field[0])), K);
			return verify_case(casenum, expected__, received__, clock()-start__);
		}

		// custom cases

/*      case 4: {
			string field[]            = ;
			int K                     = ;
			long long expected__      = ;

			clock_t start__           = clock();
			long long received__      = XorLife().countAliveCells(vector &lt;string&gt;(field, field + (sizeof field / sizeof field[0])), K);
			return verify_case(casenum, expected__, received__, clock()-start__);
		}*/
/*      case 5: {
			string field[]            = ;
			int K                     = ;
			long long expected__      = ;

			clock_t start__           = clock();
			long long received__      = XorLife().countAliveCells(vector &lt;string&gt;(field, field + (sizeof field / sizeof field[0])), K);
			return verify_case(casenum, expected__, received__, clock()-start__);
		}*/
/*      case 6: {
			string field[]            = ;
			int K                     = ;
			long long expected__      = ;

			clock_t start__           = clock();
			long long received__      = XorLife().countAliveCells(vector &lt;string&gt;(field, field + (sizeof field / sizeof field[0])), K);
			return verify_case(casenum, expected__, received__, clock()-start__);
		}*/
		default:
			return -1;
		}
	}
}

int main(int argc, char *argv[]) {
	if (argc == 1) {
		moj_harness::run_test();
	} else {
		for (int i=1; i&lt;argc; ++i)
			moj_harness::run_test(atoi(argv[i]));
	}
}
// END CUT HERE
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.shuizilong.com/house/archives/srm-481/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>&#8230; Apr 22th 蕪湖出展記錄。。</title>
		<link>http://www.shuizilong.com/house/archives/apr-22th-%e8%95%aa%e6%b9%96%e5%87%ba%e5%b1%95%e8%a8%98%e9%8c%84%e3%80%82%e3%80%82/</link>
		<comments>http://www.shuizilong.com/house/archives/apr-22th-%e8%95%aa%e6%b9%96%e5%87%ba%e5%b1%95%e8%a8%98%e9%8c%84%e3%80%82%e3%80%82/#comments</comments>
		<pubDate>Mon, 23 Apr 2012 06:58:54 +0000</pubDate>
		<dc:creator>xiaodao</dc:creator>
				<category><![CDATA[日常]]></category>

		<guid isPermaLink="false">http://www.shuizilong.com/house/?p=190</guid>
		<description><![CDATA[..被邀合影次數。。（餓。。30次左右吧。。比上次已經強多了。。） 。成功勾搭到的妹紙數。。：4 名。。。。。 。。成功勾搭到的画师：。。2名。。 。。生意很差。。很差。。（大概是因為人都去拍照了。。而且之前的 xxxx 也坑掉緣故。。]]></description>
			<content:encoded><![CDATA[<p><span id="more-190"></span><br />
..被邀合影次數。。（餓。。30次左右吧。。比上次已經強多了。。）</p>
<p>。成功勾搭到的妹紙數。。：4 名。。。。。</p>
<p>。。成功勾搭到的画师：。。2名。。</p>
<p>。。生意很差。。很差。。（大概是因為人都去拍照了。。而且之前的 xxxx 也坑掉緣故。。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shuizilong.com/house/archives/apr-22th-%e8%95%aa%e6%b9%96%e5%87%ba%e5%b1%95%e8%a8%98%e9%8c%84%e3%80%82%e3%80%82/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>私の夢日記 .. .</title>
		<link>http://www.shuizilong.com/house/archives/watashinoyumeinikki/</link>
		<comments>http://www.shuizilong.com/house/archives/watashinoyumeinikki/#comments</comments>
		<pubDate>Sat, 21 Apr 2012 21:23:46 +0000</pubDate>
		<dc:creator>xiaodao</dc:creator>
				<category><![CDATA[日常]]></category>

		<guid isPermaLink="false">http://www.shuizilong.com/house/?p=188</guid>
		<description><![CDATA[&#8230; . 说实话丽香是控猎奇系的，所以听说梦日记的时候欢快的跑去玩。 然后断断续续的拖了两年左右，在比一般人更彻底的通关之后终于按下了带shift的删除。 拜拜，对不起，附窗子。 你的梦日记，没有隐藏结局。 刚开始的时候是玩。后来是忍耐。再后来是恐惧，有时候快哭出来。 渐渐习惯了，从直接alt+F4到迅速捏脸存档。 被鸟人关过无数次，追不上蜡烛；在无数的世界中转圈；用菜刀到处捅。 一个人孤单的骑着自行车，坐宇宙船去了火星。 慢慢找齐了所有的蛋，把他们抛弃在门的房间。 对着陪自己很久的梦说拜拜，在最终的梯子上安静的坐着。 直到死前最后一秒，还是那样面无表情。 直到死前最后一秒，房间的门还是没打开。 都那么努力了。都被吓到那么多次了。 丽香是那么诚心诚意的，祈求着你的幸福啊……！ 后面的方法就有些不正当了。 下了RPG2003。通过修改打开了地图。 想知道隐藏结局的条件，在每一个角落拼命找。 但是没有。……真的没有。 唯一可以称作隐藏的，就是FC世界地图上的大片空白。 果然，幸福什么的，只不过是无聊的奢望。 如果有能够打开那扇房间门的条件，明明怎样都会去做的。 对不起，附窗子。 梦日记没有隐藏结局，你唯一的路就是走上梯子。 对不起，对不起，对不起。 对不起……我已经，做不到了。 shift+delete。 再见了，附窗户。 就算那扇门打不开…… 明明……有窗户啊。]]></description>
			<content:encoded><![CDATA[<p>&#8230; .<br />
<span id="more-188"></span><br />
<a href="http://www.shuizilong.com/house/wp-content/uploads/2012/04/original_u2C1_7dac000025b2125b.jpg"><img src="http://www.shuizilong.com/house/wp-content/uploads/2012/04/original_u2C1_7dac000025b2125b.jpg" alt="" title="original_u2C1_7dac000025b2125b" width="660" height="522" class="aligncenter size-full wp-image-189" /></a></p>
<pre>说实话丽香是控猎奇系的，所以听说梦日记的时候欢快的跑去玩。
然后断断续续的拖了两年左右，在比一般人更彻底的通关之后终于按下了带shift的删除。
拜拜，对不起，附窗子。
你的梦日记，没有隐藏结局。

刚开始的时候是玩。后来是忍耐。再后来是恐惧，有时候快哭出来。
渐渐习惯了，从直接alt+F4到迅速捏脸存档。
被鸟人关过无数次，追不上蜡烛；在无数的世界中转圈；用菜刀到处捅。
一个人孤单的骑着自行车，坐宇宙船去了火星。
慢慢找齐了所有的蛋，把他们抛弃在门的房间。
对着陪自己很久的梦说拜拜，在最终的梯子上安静的坐着。
直到死前最后一秒，还是那样面无表情。
直到死前最后一秒，房间的门还是没打开。

都那么努力了。都被吓到那么多次了。
丽香是那么诚心诚意的，祈求着你的幸福啊……！

后面的方法就有些不正当了。
下了RPG2003。通过修改打开了地图。
想知道隐藏结局的条件，在每一个角落拼命找。
但是没有。……真的没有。
唯一可以称作隐藏的，就是FC世界地图上的大片空白。

果然，幸福什么的，只不过是无聊的奢望。
如果有能够打开那扇房间门的条件，明明怎样都会去做的。
对不起，附窗子。
梦日记没有隐藏结局，你唯一的路就是走上梯子。
对不起，对不起，对不起。

对不起……我已经，做不到了。
shift+delete。
再见了，附窗户。

就算那扇门打不开……
明明……有窗户啊。</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.shuizilong.com/house/archives/watashinoyumeinikki/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TCO 2012 Round 2A</title>
		<link>http://www.shuizilong.com/house/archives/tco-2012-round-2a/</link>
		<comments>http://www.shuizilong.com/house/archives/tco-2012-round-2a/#comments</comments>
		<pubDate>Sat, 21 Apr 2012 18:05:13 +0000</pubDate>
		<dc:creator>xiaodao</dc:creator>
				<category><![CDATA[TopCoder]]></category>

		<guid isPermaLink="false">http://www.shuizilong.com/house/?p=186</guid>
		<description><![CDATA[Brief description: 300: SwitchesAndLamps: 。。给定 n 组开关和灯泡，以及 m 组开关与灯泡的对应关系，(以子集的方式给出)。。 问至少再添加多少组，可以一一确定开关与灯泡的对应关系.. . .. .( .. n, m ≤ 50 .. ) .. . 450: CucumberWatering 。。某人要按照顺序经过数轴上的 n 个点 ( 有返回现象，不保证递增)。。 。问在可以安置 m 个传送门的情况时的最小代价。。( 经过一个传送门可以选择从任意一个传送门出来。。) .. .( .. n, m ≤ 50 &#8230; <a href="http://www.shuizilong.com/house/archives/tco-2012-round-2a/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<h3>Brief description: </h3>
<p>300: SwitchesAndLamps:<br />
。。给定 n 组开关和灯泡，以及 m 组开关与灯泡的对应关系，(以子集的方式给出)。。<br />
问至少再添加多少组，可以一一确定开关与灯泡的对应关系.. .<br />
.. .( .. n, m ≤ 50 .. ) .. .</p>
<p>450: CucumberWatering<br />
。。某人要按照顺序经过数轴上的 n 个点 ( 有返回现象，不保证递增)。。<br />
。问在可以安置 m 个传送门的情况时的最小代价。。( 经过一个传送门可以选择从任意一个传送门出来。。)<br />
.. .( .. n, m ≤ 50 .. ) .. .</p>
<p>1000: EvenPaths<br />
。。给定一个 有 n 个点的 DAG 。。其中有 m 个点是可以封闭的。。<br />
。。当从 0 出发到 1 的路径总数是偶数的时候那么称之为 Nice 的。。。问 Among 这 2^m 种状态中，有多少种是 Nice 的。。</p>
<p><span id="more-186"></span></p>
<h3>Analysis: </h3>
<p>这盘按照 450->300->1000 的顺序。。</p>
<p>首先 450 出了很大的问题。。。首先我也意识到了解的离散性。。但我犯的错误是。。总是纠结对数轴上的 n 个点是保留排序后的，还是不排序的。。。<br />
。。。( 但其实是两个都要保留。。) 再之后就是对 w 数组错误认识。。。(。。一直认为要从每对传送门的角度。。来松弛路径导致无法书写状态转移方程。。)</p>
<p>另外犯的错。。在明明知道是动态规划但是不会动态规划的时候还去想了个贪心。。。( 居然还调对了样例。。。但是明显是错的。。不愿交。。Orz。)。。。其实总的说来 450 是一个比较常规的 2D/1D DP。。(。。状态两维, 枚举状态转移 1 维。。另外 w 数组好像可以 O(n2) 预处理。。。)。。。</p>
<p>最后留了 25 分钟做 300。。其实 300 想的方法其实还是比较好的。。写了一个很优美的递归。。( 避免了二分图匹配。。)。。<br />
 (。。<a href="http://community.topcoder.com/stat?c=coder_room_stats&#038;rd=15093&#038;cr=22727863">现场生代码</a> 胡乱 yy 了一个对称的位运算表达式调过了样例居然就交了。。。)。。其实正确的方法只要判断 count_bits(s) != count_bits(l) 就行了。。。= =。。。</p>
<pre class="brush: cpp; collapse: true; first-line: 1; light: false; title: SwitchesAndLamps; toolbar: true; notranslate">
const int MOD = 1000000007;
const int INF = 0x7fffffff;

const int N = 50;

inline bool _1(LL x, int i){return x &amp;amp; 1LL&amp;lt;&amp;lt;i;}
inline LL _1(int i){return 1LL&amp;lt;&amp;lt;i;}
inline LL _U(int i){return _1(i) - 1;};

vector &amp;lt;string&amp;gt; S, L; int n, m;
int res; bool Bad;

int count_bits(LL mask){
    int res = 0; REP(i, n) if (_1(mask, i)) ++res;
    return res;
}

void Gao(int k = 0, LL s = _U(n), LL l = _U(n)){

    if (Bad) return; if (count_bits(s) != count_bits(l)){Bad = true; return;}
    if (count_bits(s) &amp;lt;= 1) return;

    if (k == m) checkMax(res, count_bits(s));
    else {
        LL _s = 0, s_ = 0, _l = 0, l_ = 0; REP(i, n){
            if (S[k][i] == 'Y') _s |= _1(i);
            if (L[k][i] == 'Y') _l |= _1(i);
        }

        s_ = ~_s, l_ = ~_l;

        Gao(k + 1, s &amp;amp; _s, l &amp;amp; _l );
        Gao(k + 1, s &amp;amp; s_, l &amp;amp; l_);
    }
}

class SwitchesAndLamps {
public:
  int theMin(vector &amp;lt;string&amp;gt; switches, vector &amp;lt;string&amp;gt; lamps) {
        S = switches, L = lamps, n = SZ(L[0]), m = SZ(L);
        res = 1; Bad = false; Gao();
        return Bad ? -1 : int(ceil(log2(res)));
  }
};
</pre>
<pre class="brush: cpp; collapse: true; first-line: 1; light: false; title: CucumberWatering; toolbar: true; notranslate">
const LL INF = (1LL &lt;&lt; 60);
const int Null = -1;

struct CucumberWatering{

    vector&lt;LL&gt; P; vector&lt;pair&lt;LL, LL&gt; &gt; L;
    LL _F[52][51], _W[50][50]; int n;

    LL w(int l, int r){
        LL &amp;W = _W[l][r]; if (W == Null){
            LL a = P[l], b = P[r]; W = 0; ECH(q, L) {
                LL c = q-&gt;first, d = q-&gt;second;
                if ((a &lt;= c &amp;&amp; c &lt;= b) &amp;&amp; (a &lt;= d &amp;&amp; d &lt;= b)) W += min(d - c, (c - a) + (b - d));
                else if (a &lt;= c &amp;&amp; c &lt;= b) W += min(c - a, b - c);
                else if (a &lt;= d &amp;&amp; d &lt;= b) W += min(d - a, b - d);
            }
        }
        return W;
    }

    LL f(int l, int remK){
        LL &amp;F = _F[l][remK]; if (F == Null){
            F = w(l, n+1);
            if (remK != 0) FOR_1(i, l+1, n)
                checkMin(F, w(l, i) + f(i, remK-1));
        }
        return F;
    }

    LL theMin(vector &lt;int&gt; X, int K){
        n = SZ(X); ECH(it, X) P.PB(*it); P.PB(-INF), P.PB(+INF), SRT(P);
        FOR(i, 1, n) L.PB(MP(min(X[i], X[i-1]), max(X[i], X[i-1]))); FLC(_F, _W, -1);
        return f(0, K);
    }
};
</pre>
<p>。。。。。2B 再来过吧。。。。 <img src='http://www.shuizilong.com/house/wp-includes/images/smilies/m/Face_23.png' alt='/$:o~o' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.shuizilong.com/house/archives/tco-2012-round-2a/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

