又是不得了的建图姿势。。。。
#include<iostream>
#include<cstring>
#include<cstdio>
#define T 10001
const
int INF=1<<29;
using namespace std;
int n,m,cnt=1,tot,ans,head[10001],h[10002];
int a[101][101],b[101][101],c[101][101];
int xx[4]={0,0,1,-1},yy[4]={1,-1,0,0};
bool color[101][101];
struct data{int to,next,v;}e[100001];
char hc;
inline void read(int &a)
{
a=0;do hc=getchar();while(hc<'0'||hc>'9');
while(hc<='9'&&hc>='0')a=(a<<3)+(a<<1)+hc-'0',hc=getchar();
}
void ins(int u,int v,int w)
{cnt++;e[cnt].to=v;e[cnt].v=w;e[cnt].next=head[u];head[u]=cnt;}
void insert(int u,int v,int w)
{tot+=w;ins(u,v,w);ins(v,u,0);}
bool bfs()
{
int q[10005],t=0,w=1,i,now;
memset(h,-1,sizeof(h));
q[0]=h[0]=0;
while(t!=w)
{
now=q[