锘??xml version="1.0" encoding="utf-8" standalone="yes"?>久久久久国产精品麻豆AR影院,久久人人爽人人爽人人av东京热,久久精品无码午夜福利理论片http://www.shnenglu.com/yuziyu/category/11013.html姣忓ぉ榪涙涓鐐圭偣,Coding Everyday!zh-cnSat, 11 Jul 2009 04:24:28 GMTSat, 11 Jul 2009 04:24:28 GMT60USACO 3.4 Raucous Rockershttp://www.shnenglu.com/yuziyu/archive/2009/07/11/89781.htmlYZYYZYSat, 11 Jul 2009 03:48:00 GMThttp://www.shnenglu.com/yuziyu/archive/2009/07/11/89781.htmlhttp://www.shnenglu.com/yuziyu/comments/89781.htmlhttp://www.shnenglu.com/yuziyu/archive/2009/07/11/89781.html#Feedback0http://www.shnenglu.com/yuziyu/comments/commentRss/89781.htmlhttp://www.shnenglu.com/yuziyu/services/trackbacks/89781.html涓寮濮嬫妸棰樻剰鐞嗚В閿欎簡錛屼互涓哄埢鍦ㄥ悓涓寮犲厜鐩樹笂鐨勬瓕鏇茬殑鏃墮棿欏哄簭涓嶅彉灝卞彲浠ヤ簡銆?br />浜嬪疄涓婁笉浠呭悓鍏夌洏涓婄殑姝屾洸鍐欏叆鏃墮棿瑕佹寜欏哄簭錛屽墠涓寮犲厜鐩樹笂鐨勬瓕鏇蹭笉鑳芥瘮鍚庝竴寮犳瓕鏇插啓鍏ユ椂闂磋鏅氥?br />
鏁版嵁閲忔瘮杈冨皯錛岀敤鍥炴函娉曪紝dp涔熻銆?br />
#include聽<iostream>
#include聽
<fstream>

usingnamespace聽std;

ifstream聽fin(
"rockers.in");
ofstream聽fout(
"rockers.out");

#ifdef聽_DEBUG
#define聽out聽cout
#define聽in聽cin
#else
#define聽out聽fout
#define聽in聽fin
#endif

int聽capacity[20];;
int聽songs[20];
int聽song_num,disk_num;

int聽res聽=0;
int聽cur;

void聽backtracing(int聽depth,int聽last)
{
聽聽聽聽
if(depth==song_num){
聽聽聽聽聽聽聽聽
if(cur>res){
聽聽聽聽聽聽聽聽聽聽聽聽res聽
=聽cur;
聽聽聽聽聽聽聽聽}
聽聽聽聽聽聽聽聽
return;
聽聽聽聽}
聽聽聽
聽聽聽 //濡傛灉鍚庨潰鎵鏈夌殑姝屾洸閮藉姞涓婅繕姣旀渶浼樺煎皬錛屽壀鏋?br />聽聽聽聽
if(cur+song_num-depth<=res)
聽聽聽聽聽聽聽
return;聽

聽聽聽聽
for(int聽i=last;i<disk_num;++i){
聽聽聽聽聽聽聽聽 //濡傛灉褰撳墠姝屾洸闇瑕佸埢褰曪紝閭e彧闇鍒誨湪絎竴寮犺兘瑁呭緱涓嬬殑鍏夌洏涓娿?br />聽聽聽聽聽聽聽聽
if(聽capacity[i]>=songs[depth]){
聽聽聽聽聽聽聽聽聽聽聽聽cur
++;
聽聽聽聽聽聽聽聽聽聽聽聽capacity[i]
-=songs[depth];
聽聽聽聽聽聽聽聽聽聽聽聽backtracing(depth
+1,i);
聽聽聽聽聽聽聽聽聽聽聽聽capacity[i]
+=songs[depth];
聽聽聽聽聽聽聽聽聽聽聽聽cur
--;
聽聽聽聽聽聽聽聽聽聽聽聽
break;
聽聽聽聽聽聽聽聽}
聽聽聽聽}

聽聽聽 // 涓嶅埢褰撳墠姝屾洸
聽聽聽聽backtracing(depth
+1,last);

}

void聽solve()
{
聽聽聽聽
int聽c;
聽聽聽聽
in>>song_num>>c>>disk_num;

聽聽聽聽
for(int聽i=0;i<song_num;++i)
聽聽聽聽聽聽聽聽
in>>songs[i];

聽聽聽聽
for(int聽i=0;i<disk_num;++i)
聽聽聽聽聽聽聽聽capacity[i]聽
=聽c;

聽聽聽聽backtracing(
0,0);

聽聽聽聽
out<<res<<endl;
}

int聽main(int聽argc,char*argv[])
{
聽聽聽聽solve();聽
聽聽聽聽
return0;
}




YZY 2009-07-11 11:48 鍙戣〃璇勮
]]>
USACO 3.2 Magic Squareshttp://www.shnenglu.com/yuziyu/archive/2009/07/06/89392.htmlYZYYZYMon, 06 Jul 2009 12:01:00 GMThttp://www.shnenglu.com/yuziyu/archive/2009/07/06/89392.htmlhttp://www.shnenglu.com/yuziyu/comments/89392.htmlhttp://www.shnenglu.com/yuziyu/archive/2009/07/06/89392.html#Feedback0http://www.shnenglu.com/yuziyu/comments/commentRss/89392.htmlhttp://www.shnenglu.com/yuziyu/services/trackbacks/89392.html
#include聽<iostream>
#include聽
<fstream>
#include聽
<set>
#include聽
<queue>

usingnamespace聽std;

ifstream聽fin(
"msquare.in");
ofstream聽fout(
"msquare.out");

#ifdef聽_DEBUG
#define聽out聽cout
#define聽in聽cin
#else
#define聽out聽fout
#define聽in聽fin
#endif

int聽final[8];
set<int>visited;
char聽result[8*7*6*5*4*3*2*1+1];

struct聽queue_node{
聽聽聽聽
int聽current[8];
聽聽聽聽queue_node聽
*parent;
聽聽聽聽
char聽op;
};

void聽op(int*current,char聽c)
{
聽聽聽聽
int聽tmp;
聽聽聽聽
switch(c){
聽聽聽聽聽聽聽聽
case'A':
聽聽聽聽聽聽聽聽聽聽聽聽
for(int聽i=0;i<4;++i)
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽swap(current[i],current[
7-i]);
聽聽聽聽聽聽聽聽聽聽聽聽
break;
聽聽聽聽聽聽聽聽
case'B':
聽聽聽聽聽聽聽聽聽聽聽聽tmp聽
=聽current[3];
聽聽聽聽聽聽聽聽聽聽聽聽
for(int聽i=3;i>=1;--i)
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽current[i]聽
=聽current[i-1];
聽聽聽聽聽聽聽聽聽聽聽聽current[
0]聽=聽tmp;
聽聽聽聽聽聽聽聽聽聽聽聽tmp聽
=聽current[4];
聽聽聽聽聽聽聽聽聽聽聽聽
for(int聽i=4;i<=6;++i)
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽current[i]聽
=聽current[i+1];
聽聽聽聽聽聽聽聽聽聽聽聽current[
7]聽=聽tmp;
聽聽聽聽聽聽聽聽聽聽聽聽
break;
聽聽聽聽聽聽聽聽
case'C':
聽聽聽聽聽聽聽聽聽聽聽聽tmp聽
=聽current[6];
聽聽聽聽聽聽聽聽聽聽聽聽current[
6]聽=聽current[5];
聽聽聽聽聽聽聽聽聽聽聽聽current[
5]聽=聽current[2];
聽聽聽聽聽聽聽聽聽聽聽聽current[
2]聽=聽current[1];
聽聽聽聽聽聽聽聽聽聽聽聽current[
1]聽=聽tmp;
聽聽聽聽聽聽聽聽聽聽聽聽
break;
聽聽聽聽}
}

int聽cur_value(int*cur)
{
聽聽聽聽
int聽res聽=0;
聽聽聽聽
for(int聽i=0;i<8;++i){
聽聽聽聽聽聽聽聽res
*=10;
聽聽聽聽聽聽聽聽res
+=cur[i];
聽聽聽聽}

聽聽聽聽
return聽res;
}


void聽solve()
{
聽聽聽聽
for(int聽i=0;i<8;++i){
聽聽聽聽聽聽聽聽
in>>final[i];
聽聽聽聽}

聽聽聽聽queue
<queue_node*>聽q;
聽聽聽聽queue_node聽
*node聽=new聽queue_node;
聽聽聽聽
for(int聽i=0;i<8;++i)
聽聽聽聽聽聽聽聽node
->current[i]聽=聽i+1;

聽聽聽聽node
->parent聽=聽NULL;

聽聽聽聽q.push(node);

聽聽聽聽
while(聽!q.empty()聽){
聽聽聽聽聽聽聽聽queue_node聽
*node聽=聽q.front();
聽聽聽聽聽聽聽聽q.pop();

聽聽聽聽聽聽聽聽
int聽cur聽=聽cur_value(node->current);
聽聽聽聽聽聽聽聽
if(聽visited.find(聽cur)聽!=聽visited.end())
聽聽聽聽聽聽聽聽聽聽聽聽
continue;
聽聽聽聽聽聽聽聽visited.insert(cur);

聽聽聽聽聽聽聽聽
bool聽ok聽=true;
聽聽聽聽聽聽聽聽
for(int聽i=0;i<8;++i){
聽聽聽聽聽聽聽聽聽聽聽聽
if(node->current[i]!=final[i]){
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽ok聽
=false;
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
break;
聽聽聽聽聽聽聽聽聽聽聽聽}
聽聽聽聽聽聽聽聽}

聽聽聽聽聽聽聽聽
if(ok){
聽聽聽聽聽聽聽聽聽聽聽聽
int聽i聽=0;
聽聽聽聽聽聽聽聽聽聽聽聽
while(node->parent!=NULL){
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽result[i
++]聽=聽node->op;
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽node
=node->parent;
聽聽聽聽聽聽聽聽聽聽聽聽}

聽聽聽聽聽聽聽聽聽聽聽聽
if(i==0){
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
out<<0<<endl<<endl;
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽exit(
0);
聽聽聽聽聽聽聽聽聽聽聽聽}

聽聽聽聽聽聽聽聽聽聽聽聽
out<<i<<endl;

聽聽聽聽聽聽聽聽聽聽聽聽
int聽j;
聽聽聽聽聽聽聽聽聽聽聽聽i
--;
聽聽聽聽聽聽聽聽聽聽聽聽
for(j=0;i>=0;i--,j++){
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
out<<result[i];
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
if(j%60==59)聽out<<endl;
聽聽聽聽聽聽聽聽聽聽聽聽}
聽聽聽聽聽聽聽聽聽聽聽聽
聽聽聽聽聽聽聽聽聽聽聽聽
if(j%60!=0)
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
out<<endl;

聽聽聽聽聽聽聽聽聽聽聽聽exit(
0);
聽聽聽聽聽聽聽聽}

聽聽聽聽聽聽聽聽
for(char聽c='A';c<='C';++c){
聽聽聽聽聽聽聽聽聽聽聽聽queue_node聽
*聽n聽=new聽queue_node;
聽聽聽聽聽聽聽聽聽聽聽聽memcpy(n
->current,node->current,sizeof(node->current));
聽聽聽聽聽聽聽聽聽聽聽聽op(n
->current,c);
聽聽聽聽聽聽聽聽聽聽聽聽n
->op聽=聽c;
聽聽聽聽聽聽聽聽聽聽聽聽n
->parent聽=聽node;
聽聽聽聽聽聽聽聽聽聽聽聽q.push(n);
聽聽聽聽聽聽聽聽}
聽聽聽聽}
}

int聽main(int聽argc,char*argv[])
{
聽聽聽聽solve();聽
聽聽聽聽
return0;
}




YZY 2009-07-06 20:01 鍙戣〃璇勮
]]>
USACO 2.4 Cow Tourshttp://www.shnenglu.com/yuziyu/archive/2009/06/27/88662.htmlYZYYZYSat, 27 Jun 2009 14:10:00 GMThttp://www.shnenglu.com/yuziyu/archive/2009/06/27/88662.htmlhttp://www.shnenglu.com/yuziyu/comments/88662.htmlhttp://www.shnenglu.com/yuziyu/archive/2009/06/27/88662.html#Feedback0http://www.shnenglu.com/yuziyu/comments/commentRss/88662.htmlhttp://www.shnenglu.com/yuziyu/services/trackbacks/88662.html榪欓緇煎悎浜哾fs,floyd綆楁硶銆?br />
棣栧厛鐢?floyd璁$畻鍑轟袱涓や箣闂寸殑鏈鐭礬寰勩傜劧鍚庣敤dfs灝嗗浘鐫鑹層傚姣忎袱涓や笉鍚岄鑹茬殑緇撶偣錛屾垜浠妸瀹冧滑鐩歌繛錛岀劧鍚庣湅浜х敓鐨勫浘鐨勭洿寰勭殑澶у皬銆?br />鐩村緞鐨勫ぇ灝忓彧鍙兘浠嶄負鍘熶袱榪為氬浘鐩村緞涔嬩竴錛屾垨鑰呮槸鍖呮嫭鏂版坊鍔犵殑璺緞鎵浜х敓鐨勬渶闀胯礬寰勶紝鍙栬繖涓夎呬腑鐨勬渶澶у箋傛柊璺緞浜х敓鐨勬渶闀胯礬寰勫彧鍙兘鏄袱鐐圭殑璺濈鍔犱笂涓ょ偣鍒板叾浠栫偣鐨勬渶闀胯窛紱匯傛渶寮濮嬬殑鏃跺欏彧鑰冭檻浜嗘柊娣誨姞鐨勮礬寰勶紝娌¤冭檻鍘熺洿寰勪細姣旀柊璺緞澶х殑鎯呭喌錛寃a浜唍嬈°傘?br />
#include聽<iostream>
#include聽
<fstream>

#include聽
<cfloat>
#include聽
<cmath>

usingnamespace聽std;

ifstream聽fin(
"cowtour.in");
ofstream聽fout(
"cowtour.out");

#ifdef聽_DEBUG
#define聽out聽cout
#define聽in聽cin
#else
#define聽out聽fout
#define聽in聽fin
#endif

double聽path[150][150];

char聽graph[150][150];

int聽x[150];
int聽y[150];

int聽n;

int聽color[150];

double聽diameter[150];
double聽maxPath[150];

void聽floyd()
{
聽聽聽聽
for(int聽k=0;k<n;++k)
聽聽聽聽聽聽聽聽
for(int聽i=0;i<n;++i)
聽聽聽聽聽聽聽聽聽聽聽聽
for(int聽j=0;j<n;++j){
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
if(i!=j){
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽path[i][j]
=min(path[i][j],path[i][k]+path[k][j]);
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽}
聽聽聽聽聽聽聽聽聽聽聽聽}
}

void聽make_color(int聽i,int聽c)
{
聽聽聽聽
if(聽color[i]!=0聽)
聽聽聽聽聽聽聽聽
return;

聽聽聽聽color[i]聽
=聽c;

聽聽聽聽
for(int聽j=0;j<n;++j){
聽聽聽聽聽聽聽聽
if(color[j]==0&&graph[i][j])
聽聽聽聽聽聽聽聽聽聽聽聽make_color(j,c);
聽聽聽聽}
}


void聽solve()
{
聽聽聽聽
in>>n;

聽聽聽聽
for(int聽i=0;i<n;++i){
聽聽聽聽聽聽聽聽
in>>x[i]>>y[i];
聽聽聽聽}

聽聽聽聽
for(int聽i=0;i<n;++i){
聽聽聽聽聽聽聽聽
string聽s;
聽聽聽聽聽聽聽聽
in>>s;
聽聽聽聽聽聽聽聽
for(int聽j=0;j<n;++j){
聽聽聽聽聽聽聽聽聽聽聽聽graph[i][j]
=s[j]-'0';
聽聽聽聽聽聽聽聽聽聽聽聽
if(graph[i][j]){
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽path[i][j]聽
=聽sqrt(聽(x[i]-x[j])*(x[i]-x[j])
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
+(y[i]-y[j])*(y[i]-y[j])聽);
聽聽聽聽聽聽聽聽聽聽聽聽}
else{
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽path[i][j]聽
=聽DBL_MAX/4;
聽聽聽聽聽聽聽聽聽聽聽聽}
聽聽聽聽聽聽聽聽}
聽聽聽聽}

聽聽聽聽floyd();

聽聽聽聽
int聽c聽=0;
聽聽聽聽
for(int聽i=0;i<n;++i)
聽聽聽聽聽聽聽聽
if(color[i]==0)
聽聽聽聽聽聽聽聽聽聽聽聽make_color(i,
++c);


聽聽聽聽
for(int聽i=0;i<n;++i){
聽聽聽聽聽聽聽聽maxPath[i]聽
=0;
聽聽聽聽聽聽聽聽
for(int聽j=0;j<n;++j){
聽聽聽聽聽聽聽聽聽聽聽聽
if(i!=j&&color[i]==color[j]){
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽maxPath[i]聽
=聽max(maxPath[i],path[i][j]);
聽聽聽聽聽聽聽聽聽聽聽聽}
聽聽聽聽聽聽聽聽}

聽聽聽聽聽聽聽聽diameter[color[i]]聽
=聽max(diameter[color[i]],maxPath[i]);
聽聽聽聽}


聽聽聽聽
double聽dia聽=聽DBL_MAX;

聽聽聽聽
for(int聽i=0;i<n;++i)
聽聽聽聽聽聽聽聽
for(int聽j=i+1;j<n;++j){

聽聽聽聽聽聽聽聽聽聽聽聽
if(color[i]==color[j])聽continue;

聽聽聽聽聽聽聽聽聽聽聽聽
double聽d1聽=0;
聽聽聽聽聽聽聽聽聽聽聽聽
for(int聽p=0;p<n;++p){
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
if(i!=p&&color[i]==color[p])
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽d1聽
=聽max(d1,path[i][p]);
聽聽聽聽聽聽聽聽聽聽聽聽}

聽聽聽聽聽聽聽聽聽聽聽聽
double聽d2聽=0;
聽聽聽聽聽聽聽聽聽聽聽聽
for(int聽p=0;p<n;++p){
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
if(j!=p&&color[j]==color[p])
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽d2聽
=聽max(d2,path[j][p]);
聽聽聽聽聽聽聽聽聽聽聽聽}

聽聽聽聽聽聽聽聽聽聽聽聽
double聽dist聽=聽sqrt(聽(x[i]-x[j])*(x[i]-x[j])+
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽(y[i]
-y[j])*(y[i]-y[j])聽);

聽聽聽聽聽聽聽聽聽聽聽聽dia聽
=聽min(dia,max(d1+d2+dist,max(diameter[color[i]],diameter[color[j]]))聽);
聽聽聽聽聽聽聽聽}

聽聽聽聽
out.setf(ios::fixed,ios::floatfield);
聽聽聽聽
out.precision(6);
聽聽聽聽
out<<dia<<endl;
}

int聽main(int聽argc,char*argv[])
{
聽聽聽聽solve();聽
聽聽聽聽
return0;
}




YZY 2009-06-27 22:10 鍙戣〃璇勮
]]>
USACO 2.4 Overfencinghttp://www.shnenglu.com/yuziyu/archive/2009/06/26/88607.htmlYZYYZYFri, 26 Jun 2009 14:25:00 GMThttp://www.shnenglu.com/yuziyu/archive/2009/06/26/88607.htmlhttp://www.shnenglu.com/yuziyu/comments/88607.htmlhttp://www.shnenglu.com/yuziyu/archive/2009/06/26/88607.html#Feedback0http://www.shnenglu.com/yuziyu/comments/commentRss/88607.htmlhttp://www.shnenglu.com/yuziyu/services/trackbacks/88607.html鎵懼嚭涓や釜榪峰鐨勫嚭鍙o紝鐒跺悗鍒嗗埆榪涜dfs錛屾眰鍑哄埌姣忎竴涓偣鐨勬渶鐭窛紱匯?br />鐒跺悗瀵規(guī)瘡涓涓偣錛屾眰鍒版渶鐭殑閭d釜鍑哄彛鐨勮窛紱伙紝鐒跺悗鍐嶆眰榪欎釜鍊肩殑鏈澶у煎嵆鍙?br />鎵懼嚭鍙e啓寰楁瘮杈冪箒鐞愩?br />
#include聽<iostream>
#include聽
<fstream>
#include聽
<queue>

usingnamespace聽std;

ifstream聽fin(
"maze1.in");
ofstream聽fout(
"maze1.out");

#ifdef聽_DEBUG
#define聽out聽cout
#define聽in聽cin
#else
#define聽out聽fout
#define聽in聽fin
#endif

char聽maze[2*100+1][2*38+1];

bool聽visited[100][38];

int聽shortest1[100][38];
int聽shortest2[100][38];

bool聽get_first;
int聽exit1r,exit1c;
int聽exit2r,exit2c;
int聽w,h;

struct聽queue_node{
聽聽聽聽
int聽i,j,depth;
聽聽聽聽queue_node(
int聽i,int聽j,int聽depth){
聽聽聽聽聽聽聽聽
this->i聽=聽i;
聽聽聽聽聽聽聽聽
this->j聽=聽j;
聽聽聽聽聽聽聽聽
this->depth聽=聽depth;
聽聽聽聽}
};

void聽bfs(int聽i,int聽j,int聽shortest[100][38])
{
聽聽聽聽queue
<queue_node>q;

聽聽聽聽q.push(queue_node(i,j,
1));

聽聽聽聽
while(!q.empty()){

聽聽聽聽聽聽聽聽queue_node聽node聽
=聽q.front();
聽聽聽聽聽聽聽聽q.pop();

聽聽聽聽聽聽聽聽
if(visited[node.i][node.j])
聽聽聽聽聽聽聽聽聽聽聽聽
continue;

聽聽聽聽聽聽聽聽visited[node.i][node.j]聽
=true;

聽聽聽聽聽聽聽聽shortest[node.i][node.j]聽
=聽node.depth;

聽聽聽聽聽聽聽聽
if(node.i!=0&&maze[2*node.i][2*node.j+1]==''){
聽聽聽聽聽聽聽聽聽聽聽聽q.push(queue_node(node.i
-1,node.j,node.depth+1));
聽聽聽聽聽聽聽聽}
聽聽聽聽聽聽聽聽
if(node.i!=h-1&&maze[2*node.i+2][2*node.j+1]==''){
聽聽聽聽聽聽聽聽聽聽聽聽q.push(queue_node(node.i
+1,node.j,node.depth+1));
聽聽聽聽聽聽聽聽}
聽聽聽聽聽聽聽聽
if(node.j!=0&&maze[2*node.i+1][2*node.j]==''){
聽聽聽聽聽聽聽聽聽聽聽聽q.push(queue_node(node.i,node.j
-1,node.depth+1));
聽聽聽聽聽聽聽聽}
聽聽聽聽聽聽聽聽
if(node.j!=w-1&&maze[2*node.i+1][2*node.j+2]==''){
聽聽聽聽聽聽聽聽聽聽聽聽q.push(queue_node(node.i,node.j
+1,node.depth+1));
聽聽聽聽聽聽聽聽}
聽聽聽聽}
}

void聽solve()
{
聽聽聽聽
in>>w>>h;

聽聽聽聽
for(int聽i=0;i<2*h+1;++i)
聽聽聽聽聽聽聽聽
for(int聽j=0;j<2*w+1;++j){

聽聽聽聽聽聽聽聽聽聽聽聽
do{
聽聽聽聽聽聽聽聽聽聽聽聽
in.get(maze[i][j]);
聽聽聽聽聽聽聽聽聽聽聽聽}
while(maze[i][j]=='\n');

聽聽聽聽聽聽聽聽聽聽聽聽
if((i==0||i==2*h||j==0||j==2*w)&&maze[i][j]==''){
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
if(!get_first){
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
if(i==2*h)
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽exit1r聽
=聽h-1;
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
else
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽exit1r聽
=聽i/2;
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
if(j==2*w)
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽exit1c聽
=聽w-1;
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
else
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽exit1c聽
=聽j/2;
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽get_first聽
=true;
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽}
else{
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
if(i==2*h)
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽exit2r聽
=聽h-1;
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
else
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽exit2r聽
=聽i/2;
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
if(j==2*w)
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽exit2c聽
=聽w-1;
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
else
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽exit2c聽
=聽j/2;
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽}
聽聽聽聽聽聽聽聽聽聽聽聽}
聽聽聽聽聽聽聽聽}

聽聽聽聽memset(visited,
0,sizeof(visited));
聽聽聽聽bfs(exit1r,exit1c,shortest1);
聽聽聽聽memset(visited,
0,sizeof(visited));
聽聽聽聽bfs(exit2r,exit2c,shortest2);

聽聽聽聽
int聽res聽=聽INT_MIN;

聽聽聽聽
for(int聽i=0;i<h;++i)
聽聽聽聽聽
for(int聽j=0;j<w;++j){
聽聽聽聽聽聽聽聽聽res聽
=聽max(res,聽min(shortest1[i][j],shortest2[i][j])聽);
聽聽聽聽聽}

聽聽聽聽
out<<res<<endl;
}

int聽main(int聽argc,char*argv[])
{
聽聽聽聽solve();聽
聽聽聽聽
return0;
}





YZY 2009-06-26 22:25 鍙戣〃璇勮
]]>
漂亮人妻被中出中文字幕久久| 色婷婷综合久久久久中文字幕| 久久亚洲AV成人无码软件| 国产精品久久久久久久app | 国产成人综合久久精品红| 国产69精品久久久久APP下载| 蜜桃麻豆WWW久久囤产精品| 久久国产色AV免费观看| 国产激情久久久久影院老熟女免费| 99热都是精品久久久久久| 国产A三级久久精品| 国产69精品久久久久99尤物| 久久久久久久久久久精品尤物| 国内精品久久久久| 97久久国产综合精品女不卡| 亚洲乱亚洲乱淫久久| 久久不见久久见免费视频7| 日韩电影久久久被窝网| 国产欧美久久一区二区| 久久伊人精品一区二区三区| 999久久久免费国产精品播放| 国产激情久久久久久熟女老人 | 欧美国产成人久久精品| 久久婷婷色综合一区二区| 国内精品伊人久久久久AV影院| 中文国产成人精品久久亚洲精品AⅤ无码精品 | 97超级碰碰碰久久久久| 久久久久久精品无码人妻| 久久久国产精品| 999久久久国产精品| 91久久精品国产91性色也| 国产产无码乱码精品久久鸭 | 国色天香久久久久久久小说| 日韩中文久久| 一日本道伊人久久综合影| 久久人搡人人玩人妻精品首页 | 亚洲日本久久久午夜精品| 思思久久好好热精品国产| 蜜臀久久99精品久久久久久| 久久精品国产亚洲7777| 久久综合五月丁香久久激情|