并查集 BFS
如果一个联通块里有一条双向边,这个联通块就构成了一个完全子图。
把原图中所有能开的会议都开掉,那么剩下的所有边都可以合并两个联通块。把这些点扔进队列里BFS就好了
代码:
#include<cctype>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define N 100005
#define F inline
using namespace std;
struct edge{
int nxt,to; }ed[N<<1];
int n,m,l,r,k,h[N],fa[N],q[N],out[N],w[N];
bool f[N]; long long ans;
F char readc(){
static char buf[100000],*l=buf,*r=buf;
if (l==r) r=(l=buf)+fread(buf,1,100000,stdin);
return l==r?EOF:*l++;
}
F