锘??xml version="1.0" encoding="utf-8" standalone="yes"?>国产精品日韩欧美久久综合,久久91这里精品国产2020,久久久久亚洲AV无码去区首 http://www.shnenglu.com/Yuan/category/16258.htmlzh-cn Thu, 21 Jul 2011 18:04:18 GMT Thu, 21 Jul 2011 18:04:18 GMT 60 Spoj 1479 鏈灝忕洿寰勭敓鎴愭爲 http://www.shnenglu.com/Yuan/archive/2011/07/21/151519.html_Yuan _Yuan Wed, 20 Jul 2011 17:12:00 GMT http://www.shnenglu.com/Yuan/archive/2011/07/21/151519.html http://www.shnenglu.com/Yuan/comments/151519.html http://www.shnenglu.com/Yuan/archive/2011/07/21/151519.html#Feedback 0 http://www.shnenglu.com/Yuan/comments/commentRss/151519.html http://www.shnenglu.com/Yuan/services/trackbacks/151519.html 闃呰鍏ㄦ枃 ]]> hdu 3832 鏋氫婦鍒嗗弶鐐?/title> http://www.shnenglu.com/Yuan/archive/2011/07/15/151084.html_Yuan _Yuan Fri, 15 Jul 2011 12:07:00 GMT http://www.shnenglu.com/Yuan/archive/2011/07/15/151084.html http://www.shnenglu.com/Yuan/comments/151084.html http://www.shnenglu.com/Yuan/archive/2011/07/15/151084.html#Feedback 0 http://www.shnenglu.com/Yuan/comments/commentRss/151084.html http://www.shnenglu.com/Yuan/services/trackbacks/151084.html /**//* n<=200涓偣鐨勬棤鍚戝浘錛岃姹傚墠3涓偣闇瑕佽繛鎺ュ湪涓璧鳳紝姹傛渶澶氳兘鍒犻櫎鐨勫叾浣欑偣 榪炲湪涓璧鳳紝鎯沖埌鐢?.. 闃呰鍏ㄦ枃 ]]> CF76A 鎺掑簭闄嶇淮 鍔犺竟鎴愮幆鍒犳渶澶ц竟 鍒╃敤MST鎬ц川 http://www.shnenglu.com/Yuan/archive/2011/05/05/145782.html_Yuan _Yuan Thu, 05 May 2011 15:36:00 GMT http://www.shnenglu.com/Yuan/archive/2011/05/05/145782.html http://www.shnenglu.com/Yuan/comments/145782.html http://www.shnenglu.com/Yuan/archive/2011/05/05/145782.html#Feedback 0 http://www.shnenglu.com/Yuan/comments/commentRss/145782.html http://www.shnenglu.com/Yuan/services/trackbacks/145782.html 闃呰鍏ㄦ枃 ]]> poj 3694 LCA媧葷敤 鍓茶竟 http://www.shnenglu.com/Yuan/archive/2010/04/30/114050.html_Yuan _Yuan Fri, 30 Apr 2010 04:16:00 GMT http://www.shnenglu.com/Yuan/archive/2010/04/30/114050.html http://www.shnenglu.com/Yuan/comments/114050.html http://www.shnenglu.com/Yuan/archive/2010/04/30/114050.html#Feedback 0 http://www.shnenglu.com/Yuan/comments/commentRss/114050.html http://www.shnenglu.com/Yuan/services/trackbacks/114050.html /**/ /* 涓嶉敊涓閬撻 棰樻剰錛氱粰鍑轟竴騫呭浘錛岄噷闈㈡湁妗ワ紝緇欏嚭Q涓搷浣滐紝 姣忎釜鎿嶄綔浼氭坊鍔犱竴鏉¤竟錛岄棶姣忔鎿嶄綔鍚庡浘涓ˉ鐨勪釜鏁?br> 姣忔姹傛ˉ浼氬お鎱?br> 鑰冭檻涓涓媎fs鏍戯紝鏍戣竟鑲畾鏄ˉ錛岀劧鍚庢瘡榪炰笂x,y錛屽氨浼氬艦鎴愪竴涓幆錛岃繖涓幆鍐呯殑杈瑰氨鍏ㄩ儴閮戒笉鏄壊杈?br> 鎵浠ュ彧瑕佹壘鍒皒,y鐨刲ca錛屾妸榪欎釜璺緞涓婄殑妗ユ爣璁頒負鍚﹀嵆鍙?br>*/ #include< cstdio > #include< cstring > #include< algorithm > using namespace std; const int MAXN = 100010 ; inline int min( int a, int b) { return a < b ? a:b;} inline int max( int a, int b) { return a > b ? a:b;} struct Node { int v,next; } nodes[MAXN * 10 ]; int G[MAXN]; int level[MAXN],low[MAXN]; int vi[MAXN],fa[MAXN]; int cut[MAXN],isBridge[MAXN]; int alloc,n,m,bridgeNum; void add( int a, int b) { alloc ++ ; nodes[alloc].v = b,nodes[alloc].next = G[a]; G[a] = alloc; } void dfs( int u, int dep) { vi[u] = 1 ; level[u] = low[u] = dep; bool flag = true ; // if(u!=1)cut[u]++; for ( int son = G[u];son;son = nodes[son].next) { int v = nodes[son].v; if (v == fa[u] && flag) { flag = false ; continue ; } if (vi[v] == 1 ) low[u] = min(low[u],level[v]); else if (vi[v] == 0 ) { fa[v] = u; dfs(v,dep + 1 ); low[u] = min(low[u],low[v]); // if(low[v]>=level[u])cut[u]++; if (low[v] > level[u]) { // bridge isBridge[v] = 1 ; bridgeNum ++ ; } } } vi[u]= 2 ; } void lca( int x, int y) { if (level[x] < level[y])swap(x,y); while (level[x] > level[y]) { if (isBridge[x]) { bridgeNum -- ; isBridge[x] = 0 ; } x= fa[x]; } while (x != y) { if (isBridge[x]) {bridgeNum -- ;isBridge[x] = 0 ;} if (isBridge[y]) {bridgeNum -- ;isBridge[y] = 0 ;} x= fa[x];y = fa[y]; } }int main() { // freopen("in","r",stdin); int a,b,t = 1 ; while (scanf( " %d%d " , & n, & m),n) { alloc = 0 ; memset(G + 1 , 0 , sizeof ( int ) * n); while (m -- ) { scanf( " %d%d " , & a, & b); add(a,b); add(b,a); } memset(vi,0 , sizeof (vi)); memset(isBridge, 0 , sizeof (isBridge)); bridgeNum = 0 ; fa[ 1 ] = 1 ; dfs( 1 , 0 ); printf( " Case %d:\n " ,t ++ ); scanf( " %d " , & m); while (m -- ) { scanf( " %d%d " , & a, & b); lca(a,b); printf( " %d\n " ,bridgeNum); } puts("" ); } return 0 ; }
]]>hdu 2242 鍙岃繛閫氱緝鐐規垚鏍?tree dp http://www.shnenglu.com/Yuan/archive/2010/04/29/114003.html_Yuan _Yuan Thu, 29 Apr 2010 14:22:00 GMT http://www.shnenglu.com/Yuan/archive/2010/04/29/114003.html http://www.shnenglu.com/Yuan/comments/114003.html http://www.shnenglu.com/Yuan/archive/2010/04/29/114003.html#Feedback 2 http://www.shnenglu.com/Yuan/comments/commentRss/114003.html http://www.shnenglu.com/Yuan/services/trackbacks/114003.html 闃呰鍏ㄦ枃 ]]> hdu 2767 鏈灝忓姞杈逛嬌鏈夊悜鍥懼彉涓哄己榪為?/title> http://www.shnenglu.com/Yuan/archive/2010/04/27/113755.html_Yuan _Yuan Tue, 27 Apr 2010 14:37:00 GMT http://www.shnenglu.com/Yuan/archive/2010/04/27/113755.html http://www.shnenglu.com/Yuan/comments/113755.html http://www.shnenglu.com/Yuan/archive/2010/04/27/113755.html#Feedback 0 http://www.shnenglu.com/Yuan/comments/commentRss/113755.html http://www.shnenglu.com/Yuan/services/trackbacks/113755.html
/**/ /* 姹傛渶灝忓姞杈逛嬌鏈夊悜鍥懼彉涓哄己榪為?br> 鍏堢緝鐐癸紝鐒跺悗璁$畻鍚勪釜寮鴻繛閫氬垎閲忕殑鍏ュ害涓?鐨勪釜鏁幫紝鍑哄害涓?鐨勪釜鏁?br> 1) SCC=1, 涓嶉渶娣昏竟 2) 娣籱ax( incnt, outcnt ) 璐績絳栫暐錛屾眹鍩哄悜鐐瑰熀榪炶竟錛屽啀娣昏竟鐨勮繛鎺ュ墿涓嬬殑鐐瑰熀/姹囧熀鍗沖彲*/ #include< cstdio > #include< cstring > #include< algorithm > #include< vector > using namespace std; const int MAXN = 20010 ; int n,m; vector < int > G[ 2 ][MAXN]; int ID[MAXN],SCC,flag; int order[MAXN],cnt; int in [MAXN], out [MAXN]; void dfs( int u) { ID[u] = SCC; for ( int i = 0 ;i < G[flag][u].size();i ++ ) { int v = G[flag][u][i]; if ( ! ID[v])dfs(v); } if (flag)order[ ++ cnt] = u; } int main() { int T,a,b; scanf( " %d " , & T); while (T -- ) { scanf( " %d%d " , & n, & m); for ( int i = 1 ;i <= n;i ++ ) { G[ 0 ][i].clear(); G[ 1 ][i].clear(); } while (m -- ) { scanf( " %d%d " , & a, & b); G[ 0 ][a].push_back(b); G[ 1 ][b].push_back(a); } flag= SCC = 1 ; cnt = 0 ; memset(ID, 0 , sizeof (ID)); for ( int i = 1 ;i <= n;i ++ ) if ( ! ID[i])dfs(i); flag = SCC = 0 ; memset(ID, 0 , sizeof (ID)); for ( int i = cnt;i;i -- ) { // 娉ㄦ剰鏄痮rder[i] if (ID[order[i]]) continue ; SCC ++ ; dfs(order[i]); } if (SCC == 1 ) {puts( " 0 " ); continue ;} memset(out , 0 , sizeof ( out )); memset( in , 0 , sizeof ( in )); for ( int i = 1 ;i <= n;i ++ ) for ( int j = 0 ;j < G[ 0 ][i].size();j ++ ) { int v = G[ 0 ][i][j]; if (ID[i] != ID[v]) { in [ID[v]] ++ ; out [ID[i]] ++ ; } } int incnt = 0 ,outcnt = 0 ; for ( int i = 1 ;i <= SCC;i ++ ) { if ( in [i] == 0 )incnt ++ ; if ( out [i] == 0 )outcnt ++ ; } printf(" %d\n " ,max(incnt,outcnt)); } return 0 ; }
]]>Poj 3463 鏈鐭礬嬈$煭璺殑璺緞鏉℃暟涔嬪拰 http://www.shnenglu.com/Yuan/archive/2010/04/19/112983.html_Yuan _Yuan Mon, 19 Apr 2010 05:59:00 GMT http://www.shnenglu.com/Yuan/archive/2010/04/19/112983.html http://www.shnenglu.com/Yuan/comments/112983.html http://www.shnenglu.com/Yuan/archive/2010/04/19/112983.html#Feedback 0 http://www.shnenglu.com/Yuan/comments/commentRss/112983.html http://www.shnenglu.com/Yuan/services/trackbacks/112983.html /**/ /* 姹俿鍒皌鐨勬渶鐭礬涓庢鐭礬錛堣繖閲岃姹傚彧姣旀渶鐭礬澶?錛夌殑鏉℃暟涔嬪拰 鑱旀兂鍒版渶灝忥紝嬈″皬鐨勪竴縐嶆洿鏂板叧緋伙細 if(x<鏈灝?鏇存柊鏈灝忥紝嬈″皬 else if(==鏈灝?鏇存柊鏂規硶鏁?br> else if(x<嬈″皬)鏇存柊嬈″皬 else if(x==嬈″皬)鏇存柊鏂規硶鏁?br> 鍚屾椂璁板綍s鍒皍鏈鐭紝嬈$煭璺強鏂規硶鏁?br> 鐢ㄤ竴涓爢姣忔鍙栨渶灝忕殑錛屾洿鏂板畬鍚庡啀鍏ュ爢 榪樻槸閭d釜鍘熺悊錛岀涓嬈¢亣鍒扮殑灝辨槸鏈浼樼殑錛岀劧鍚巚i鏍囪涓虹湡 鏂規硶鏁版敞鎰忔槸鍔犳硶鍘熺悊錛屼笉鏄箻娉?br> \ -- u -- v 鎵浠ユ槸鍔犳硶鍘熺悊 /*/ #include< cstdio > #include< cstring > #include< algorithm > #include< queue > using namespace std; const int MAXN = 1010 ; const int INF = 1000000000 ; bool vi[MAXN][ 2 ]; int dist[MAXN][ 2 ],cnt[MAXN][ 2 ]; // 0 琛ㄧず鏈鐭礬 1琛ㄧず嬈$煭璺?/span>int G[MAXN]; int n,m,alloc; struct Node { int v,w,next; } nodes[MAXN * 10 ]; struct Pos { int v,flag; Pos( int vv, int f) {v = vv,flag = f;} bool operator < ( const Pos & p) const { return dist[v][flag] > dist[p.v][p.flag]; } }; void add( int a, int b, int c) { alloc ++ ; nodes[alloc].v = b,nodes[alloc].w = c,nodes[alloc].next = G[a]; G[a] = alloc; } int dij( int s, int t) { memset(vi, 0 , sizeof (vi)); memset(cnt, 0 , sizeof (cnt)); for ( int i = 1 ;i <= n;i ++ ) dist[i][ 0 ] = dist[i][ 1 ] = INF; priority_queue < Pos > Q; Q.push(Pos(s, 0 )); dist[s][ 0 ] = 0 ;cnt[s][ 0 ] = 1 ; while ( ! Q.empty()) { Pos top = Q.top();Q.pop(); int u = top.v,flag = top.flag; if (vi[u][flag]) continue ; vi[u][flag] = 1 ; for ( int son = G[u];son;son = nodes[son].next) { int v = nodes[son].v,w = dist[u][flag] + nodes[son].w; if (w < dist[v][ 0 ]) { if (dist[v][ 0 ] != INF) { dist[v][ 1 ] = dist[v][ 0 ]; cnt[v][ 1 ] = cnt[v][ 0 ]; Q.push(Pos(v, 1 )); } dist[v][0 ] = w; cnt[v][ 0 ] = cnt[u][flag]; Q.push(Pos(v, 0 )); } else if (w == dist[v][ 0 ])cnt[v][ 0 ] += cnt[u][flag]; else if (w < dist[v][ 1 ]) { dist[v][ 1 ] = w; cnt[v][ 1 ] = cnt[u][flag]; Q.push(Pos(v, 1 )); } else if (w == dist[v][ 1 ])cnt[v][ 1 ] += cnt[u][flag]; } } int ans = cnt[t][ 0 ]; if (dist[t][ 0 ] == dist[t][ 1 ] - 1 )ans += cnt[t][ 1 ]; return ans; } int main() { int T,a,b,c; scanf( " %d " , & T); while (T -- ) { scanf( " %d%d " , & n, & m); memset(G, 0 , sizeof (G)); alloc = 0 ; while (m -- ) { scanf( " %d%d%d " , & a, & b, & c); add(a,b,c); } scanf(" %d%d " , & a, & b); printf( " %d\n " ,dij(a,b)); } return 0 ; }
]]> hdu 2444 鍒ゆ柇鏄惁浜屽垎鍥?鍐嶆渶澶у尮閰?/title> http://www.shnenglu.com/Yuan/archive/2010/04/17/112878.html_Yuan _Yuan Sat, 17 Apr 2010 15:31:00 GMT http://www.shnenglu.com/Yuan/archive/2010/04/17/112878.html http://www.shnenglu.com/Yuan/comments/112878.html http://www.shnenglu.com/Yuan/archive/2010/04/17/112878.html#Feedback 2 http://www.shnenglu.com/Yuan/comments/commentRss/112878.html http://www.shnenglu.com/Yuan/services/trackbacks/112878.html /* Your task is to divide the students into two groups so that any two students in the same group don't know each other. 涔熷嵆闂槸鍚﹀瓨鍦ㄤ簩鍒嗗浘 錛岄氳繃鍒ゆ柇鏄惁鏈夊鏁伴暱搴﹀洖璺嵆鍙?nbsp;dfs涓涓?br> 褰撶劧錛屽厑璁稿媯墊.鏋?br> then arrange them into double rooms 鐩歌瘑鐨勫悓涓闂存埧錛屽嵆姹傛渶澶у尮閰?br>*/ #include< cstdio > #include< cstring > #include< queue > #include< algorithm > using namespace std; const int MAXN = 210 ; struct Node{ int v,next; }nodes[MAXN * MAXN]; int G[MAXN]; int link[MAXN]; int n,m,alloc; int vi[MAXN]; void add( int a, int b){ alloc ++ ; nodes[alloc].v = b,nodes[alloc].next = G[a]; G[a] = alloc; } bool dfs( int u, int p){ for ( int son = G[u];son;son = nodes[son].next){ int v = nodes[son].v; if (v == p) continue ; if (vi[v] !=- 1 ){ if (vi[v] == vi[u]) return false ; // 灞傛鐩稿樊涓哄伓鏁幫紝鍗沖伓鏁板洖璺?/span> continue ; } vi[v] = 1 - vi[u]; if ( ! dfs(v,u)) return false ; } return true ; } bool find( int u){ for ( int son = G[u];son;son = nodes[son].next){ int v = nodes[son].v; if (vi[v]) continue ; vi[v] = 1 ; if ( ! link[v] || find(link[v])){ link[v] = u; return true ; } } return false ; } int main(){ // freopen("in","r",stdin); int a,b; while ( ~ scanf( " %d%d " , & n, & m)){ alloc = 0 ; memset(G, 0 , sizeof (G)); for ( int i = 0 ;i < m;i ++ ){ scanf( " %d%d " , & a, & b); add(a,b);add(b,a); } memset(vi, - 1 , sizeof (vi)); bool flag = false ; for ( int i = 1 ;i <= n;i ++ ) if (vi[i] ==- 1 ){ vi[i] = 1 ; if ( ! dfs(i,i)){ flag = true ; break ; } } if (flag){printf( " No\n " ); continue ;} int ans = 0 ; memset(link, 0 , sizeof (link)); for ( int i = 1 ;i <= n;i ++ ){ memset(vi, 0 , sizeof (vi)); ans += find(i); } printf( " %d\n " ,ans / 2 ); } return 0 ; }
]]> Poj 3686 鎷嗙偣 浜屽垎鍥炬渶浣沖尮閰?/title> http://www.shnenglu.com/Yuan/archive/2010/04/14/112519.html_Yuan _Yuan Tue, 13 Apr 2010 17:05:00 GMT http://www.shnenglu.com/Yuan/archive/2010/04/14/112519.html http://www.shnenglu.com/Yuan/comments/112519.html http://www.shnenglu.com/Yuan/archive/2010/04/14/112519.html#Feedback 0 http://www.shnenglu.com/Yuan/comments/commentRss/112519.html http://www.shnenglu.com/Yuan/services/trackbacks/112519.html /**/ /* 棰樻剰錛氭湁N涓伐浠惰鍦∕涓満鍣ㄤ笂鍔犲伐錛屾湁涓涓狽*M鐨勭煩闃墊弿榪板叾鍔犲伐鏃墮棿銆?br> 鍚屼竴鏃墮棿鍐呮瘡涓満鍣ㄥ彧鑳藉姞宸ヤ竴涓伐浠訛紝闂姞宸ュ畬鎵鏈夊伐浠跺悗錛屼嬌寰楀鉤鍧囧姞宸ユ椂闂存渶灝忋?br> 灝嗗伐浠朵綔涓轟簩鍒嗗浘涓璛閮ㄧ殑鐐癸紝鎬誨叡N涓?br> 灝嗘瘡涓満鍣ㄦ媶鎴怤涓偣浣滀負浜屽垎鍥句腑Y閮ㄧ殑鐐癸紝鎬誨叡N*M涓?br> 絎琂涓満鍣ㄧ殑絎琍涓偣浠h〃錛屼嬌鐢ㄦ満鍣?nbsp;J榪涜鍊掓暟絎琍嬈″姞宸ャ?br> 鍋囪鎴戜滑鎸夐『搴忓湪J鏈哄櫒涓婂伐浠禝1,I2,I3..IK涓伐浠訛紝鍒欐誨叡闇瑕佽姳璐笽1*K+I2*(K- 1)+I3*(K-3)+ +IK銆?br> 鎵浠ユ垜浠浜嶺涓瘡涓偣I錛孻涓瘡涓偣錛圝,P錛夛紝榪炴帴涓鏉[I,J]*P鏉冨肩殑杈廣?br> 鎺ヤ笅鏉ヨ繘琛屼簩鍒嗗浘鏈浣沖尮閰嶅嵆鍙?br>*/ #include< cstdio > #include< cstring > const int MAXN = 55 ; const int INF = 1000000000 ; int n,m; int g[MAXN][MAXN * MAXN]; int data[MAXN][MAXN]; int lx[MAXN],ly[MAXN * MAXN]; // 鍙欏舵爣 int cx[MAXN],cy[MAXN * MAXN]; // 鍖歸厤杈歸泦 bool sx[MAXN],sy[MAXN * MAXN]; bool path( int u) { // 鎵╁睍浜屽垎鍥?nbsp;鍒ゆ柇鏄惁瀛樺湪鐢辮鍏冪礌u鍑哄彂鐨勫彲澧炲箍璺緞 sx[u] = 1 ; for ( int v = 1 ;v <= m;v ++ ) { if (g[u][v] == lx[u] + ly[v] &&! sy[v]) { sy[v] = 1 ; if (cy[v] == 0 || path(cy[v])) { cx[u] = v;cy[v] = u; return true ; } } } return false ; } int KM() { memset(ly, 0 , sizeof (ly)); memset(cx, 0 , sizeof (cx)); memset(cy, 0 , sizeof (cy)); for ( int i = 1 ;i <= n;i ++ ) { lx[i] =- INF; for ( int j = 1 ;j <= m;j ++ ) if (lx[i] < g[i][j])lx[i] = g[i][j]; } for ( int u = 1 ;u <= n;u ++ ) { memset(sx, 0 , sizeof (sx)); memset(sy, 0 , sizeof (sy)); while ( ! path(u)) { int Min = INF; for ( int i = 1 ;i <= n;i ++ ) { if ( ! sx[i]) continue ; for ( int j = 1 ;j <= m;j ++ ) if ( ! sy[j] && lx[i] + ly[j] - g[i][j] < Min) Min = lx[i] + ly[j] - g[i][j]; } // 璋冩暣欏舵爣錛屼簩鍒嗗浘鎾ゅ幓璇ュ厓绱?/span> for ( int i = 1 ;i <= n;i ++ ) if (sx[i]) {lx[i] -= Min;sx[i] = false ;} for ( int i = 1 ;i <= m;i ++ ) if (sy[i]) {ly[i] += Min;sy[i] = false ;} } } int ans = 0 ; for ( int i = 1 ;i <= n;i ++ ) ans += g[i][cx[i]]; return ans; } int main() { int T; scanf( " %d " , & T); while (T -- ) { scanf( " %d%d " , & n, & m); for ( int i = 1 ;i <= n;i ++ ) for ( int j = 1 ;j <= m;j ++ ) scanf( " %d " , & data[i][j]); // build for ( int i = 1 ;i <= n;i ++ ) for ( int j = 1 ;j <= m;j ++ ) for ( int k = 1 ;k <= n;k ++ ) g[i][(j - 1 ) * n + k] =- data[i][j] * k; // 鑺辮垂 m = n * m; double ans =- 1.0 * KM() / n; printf( " %.6f\n " ,ans); } return 0 ; }
]]> Poj 2112 浜屽垎 澶氶噸鍖歸厤 http://www.shnenglu.com/Yuan/archive/2010/04/12/112296.html_Yuan _Yuan Mon, 12 Apr 2010 02:54:00 GMT http://www.shnenglu.com/Yuan/archive/2010/04/12/112296.html http://www.shnenglu.com/Yuan/comments/112296.html http://www.shnenglu.com/Yuan/archive/2010/04/12/112296.html#Feedback 1 http://www.shnenglu.com/Yuan/comments/commentRss/112296.html http://www.shnenglu.com/Yuan/services/trackbacks/112296.html /* 1y錛屾湁鐐規剰澶?br> 瀵瑰簲鍖堢墮鍒╃畻娉曠湅錛屼笉鍚岀殑鏄彸杈圭殑鐐瑰彲鍖歸厤澶氫釜*/ #include< cstdio > #include< cstring > const int MAXN = 1005 ; struct Node{ int v,next; }nodes[MAXN * MAXN]; int n,m; int G[MAXN]; int alloc,N; bool vi[MAXN]; int link[MAXN][MAXN]; void add( int a, int b){ alloc ++ ; nodes[alloc].v = b,nodes[alloc].next = G[a]; G[a] = alloc; } bool find( int u){ for ( int son = G[u];son !=- 1 ;son = nodes[son].next){ int v = nodes[son].v; // v瀵瑰簲澶氫釜鍖歸厤 if (vi[v]) continue ; vi[v] = 1 ; if (link[v][ 0 ] < N){ link[v][ ++ link[v][ 0 ]] = u; return true ; } for ( int i = 1 ;i <= link[v][ 0 ];i ++ ) if (find(link[v][i])){ link[v][i] = u; return true ; } } return false ; } bool chk(){ int ans = 0 ; for ( int i = 0 ;i < m;i ++ )link[i][ 0 ] = 0 ; for ( int i = 0 ;i < n;i ++ ){ memset(vi, 0 , sizeof (vi)); if ( ! find(i)) return false ; } return true ; } int main(){ char str[ 20 ],ch; while (scanf( " %d%d " , & n, & m),n){ memset(G, - 1 , sizeof (G)); alloc = 0 ; for ( int i = 0 ;i < n;i ++ ){ scanf( " %s " ,str); while ( 1 ){ while (ch = getchar(),ch == ' ' ); int tmp = ch - ' 0 ' ; while (ch = getchar(),ch <= ' 9 ' && ch >= ' 0 ' )tmp = 10 * tmp + ch - ' 0 ' ; add(i,tmp); if (ch == ' \n ' || ch == EOF) break ; } } int low = 0 ,high = n + 1 ; while (high - low > 1 ){ int mid = (high + low) >> 1 ; N = mid; if (chk())high = mid; else low = mid; } printf( " %d\n " ,high); } return 0 ; }
]]>
久久99精品国产麻豆蜜芽 |
国产精品99久久久久久www |
久久精品国产亚洲av瑜伽 |
国产精品99久久免费观看 |
中文精品久久久久人妻不卡 |
深夜久久AAAAA级毛片免费看
|
青春久久 |
久久精品99无色码中文字幕 |
大蕉久久伊人中文字幕 |
久久香蕉国产线看观看99 |
久久久青草久久久青草 |
精品国产福利久久久 |
久久免费视频观看 |
久久久久久久99精品免费观看 |
国内精品久久九九国产精品 |
久久精品无码一区二区无码
|
国产亚洲精久久久久久无码AV |
91精品国产高清久久久久久国产嫩草 |
国产一级持黄大片99久久 |
四虎国产永久免费久久 |
国产成人精品久久亚洲高清不卡 |
丰满少妇人妻久久久久久4 |
国产成人久久精品二区三区 |
国产视频久久 |
热久久最新网站获取 |
久久这里只有精品首页 |
久久亚洲私人国产精品 |
精品午夜久久福利大片 |
狠狠人妻久久久久久综合蜜桃 |
久久久久无码精品国产app |
99久久这里只精品国产免费 |
亚洲国产精品久久电影欧美 |
国产精品九九九久久九九 |
国内精品伊人久久久久影院对白 |
久久婷婷是五月综合色狠狠 |
色综合久久无码中文字幕 |
精品免费tv久久久久久久 |
久久久久噜噜噜亚洲熟女综合 |
久久天天躁狠狠躁夜夜2020一 |
久久国产高潮流白浆免费观看 |
精品久久人人爽天天玩人人妻 |