我把cnt初值设为0,然后这样写
e[++cnt]={v,w,head[u]};head[u]=cnt; e[++cnt]={u,0,head[v]};head[v]=cnt; ret+=d;e[i].w-=d;e[i^1].w+=d;flow-=d;
它过了