文章分类 - 拓扑
摘要://并查集+拓扑排序,‘=’ 用并查集处理#include#include#includeusing namespace std;vectornext[10005]; //相当于邻接表int set[10005]; //并查集数组int in[10005]; //记录入度int A[20005],B[20005]; char oper[20005];int n,m,sum;int find(int x){ return set[x]==x?x:find(set[x]);}int merge(int x,int y){ int a=find(x); int b=find...
阅读全文