这是由AC代码改的模板,不能直接交啊
#include#include #include using namespace std;int book[2024];vector v[2048];bool dfs(int x,int c){ book[x]=c; for(int i=0;i >T; int n,m,x,y; while(T--){ memset(book,0,sizeof(book)); cin>>n>>m; for(int i=0;i >x>>y; v[x].push_back(y); v[y].push_back(x); } int flag=0; for(int i=1;i<=n;i++){ if(!book[i]&&!dfs(i,1)){flag=1;break;} } if(flag){cout<<"非二分图"< (); } }}