### 原题传送门

#### 拆点很套路的~

``````#include <bits/stdc++.h>
#define N 205
#define M 20005
#define inf (1<<30)
#define getchar nc
using namespace std;
inline char nc(){
static char buf[100000],*p1=buf,*p2=buf;
}
{
register int x=0,f=1;register char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
while(ch>='0'&&ch<='9')x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
return x*f;
}
inline void write(register int x)
{
if(!x)putchar('0');if(x<0)x=-x,putchar('-');
static int sta[20];register int tot=0;
while(x)sta[tot++]=x%10,x/=10;
while(tot)putchar(sta[--tot]+48);
}
inline int Min(register int a,register int b)
{
return a<b?a:b;
}
struct node{
int to,next,v,c;
}e[(M<<2)+(N<<1)];
inline void add(register int u,register int v,register int val,register int cost)
{
}
int n,m,s,t,maxflow=0,mincost=0;
int vis[N<<1],dist[N<<1];
inline bool spfa()
{
memset(vis,0,sizeof(vis));
memset(dist,0x3f,sizeof(dist));
dist[s]=0;
vis[s]=1;
queue<int> q;
q.push(s);
while(!q.empty())
{
int u=q.front();
q.pop();
vis[u]=0;
{
int v=e[i].to;
if(dist[v]>dist[u]+e[i].c&&e[i].v)
{
dist[v]=dist[u]+e[i].c;
if(vis[v]==0)
{
q.push(v);
vis[v]=1;
}
}
}
}
return dist[t]!=0x3f3f3f3f;
}
inline int dfs(register int u,register int flow)
{
if(u==t)
{
vis[t]=1;
maxflow+=flow;
return flow;
}
int used=0;
vis[u]=1;
{
int v=e[i].to;
if((vis[v]==0||v==t)&&e[i].v&&dist[v]==dist[u]+e[i].c)
{
int tmp=dfs(v,Min(e[i].v,flow-used));
if(tmp)
{
mincost+=e[i].c*tmp;
used+=tmp;
e[i].v-=tmp;
e[i^1].v+=tmp;
}
if(used==flow)
return used;
}
}
return used;
}
inline void MCMF()
{
while(spfa())
{
vis[t]=1;
while(vis[t])
{
memset(vis,0,sizeof(vis));
dfs(s,inf);
}
}
}
int main()
{
s=1,t=n;
for(register int i=2;i<n;++i)
for(register int i=1;i<=m;++i)
{