POJ1291-并查集/dfs(四)

2014-11-23 21:54:17 来源: 作者: 浏览: 31
nbsp;{  
  •                   
  •                 fax = find( x1 );  
  •                 fay = find( y2 );  
  •                 if( fax==fay ){  
  •                     f = false;  
  •                     continue;  
  •                 }  
  •                 fax = find( x2 );  
  •                 fay = find( y1 );  
  •                 if( fax==fay ){  
  •                     f = false;  
  •                     continue;  
  •                 }  
  •                   
  •                 union_ab( x1,y1 );  
  •                 union_ab( x2,y2 );  
  •                 addedge( x1,y1 );  
  •                 addedge( x2,y2 );  
  •             }  
  •         }  
  •         if( f==false ) {  
  •             puts("Inconsistent");  
  •             continue;  
  •         }//specail judge  
  •         for
  • -->

    评论

    帐  号: 密码: (新用户注册)
    验 证 码:
    表  情:
    内  容: