POJ1291-并查集/dfs(三)
nbsp; scanf("%s%d%s%s",s1,&y1,s2,s3); x1 = i,x2 = i+n; y1 = y1,y2 = y1+n; //x1表示true,x2表示false if( f==false ) continue; if( s3[0]=='f' ){ fax = find( x1 ); fay = find( y1 ); if( fax==fay ){ f = false; continue; } fax = find( x2 ); fay = find( y2 ); if( fax==fay ){ f = false; continue; } union_ab( x1,y2 ); union_ab( x2,y1 ); addedge( x1,y2 ); addedge( x2,y1 ); } else&
| 评论 |
|
|
