建议检查代码中有没有出现未定义行为,如:
struct Edge{
int to, nxt;
int Cap, flow;
Edge(const int &u = 0, const int &v = 0, const int &flw = 0):to(v),Cap(flw)
{
nxt = head[u], flow = 0;
head[u] = tot;
}
}E[M<<1];
int tot = 1;
E[++tot] = Edge(u, v, w);
E[++tot] = Edge(v, u, 0);
可以改成:
++tot;
E[tot] = Edge(u, v, w);
++tot;
E[tot] = Edge(v, u, 0);
原因:
程序先计算等号右边的值再赋给左边,导致WA/TLE
但在本地没有这样的问题,怎么会事呢