@[lov0429e](/user/282080)
```cpp
if(dfn[u]==low[u])
{
cnt++;
while(!s.empty())
{
if(s.top()==u) break;
scc[s.top()]=cnt; W[cnt]+=w[s.top()];
vis[s.top()]=0; s.pop();
}
if(!s.empty())
{
scc[s.top()]=cnt; W[cnt]+=w[s.top()];
vis[s.top()]=0; s.pop();
}
}
```
这一段放到`for`循环外面
by Marser @ 2020-04-18 11:09:13
```cpp
if(dfn[u]==low[u])
{
cnt++;
while(!s.empty())
{
if(s.top()==u) break;
scc[s.top()]=cnt; W[cnt]+=w[s.top()];
vis[s.top()]=0; s.pop();
}
if(!s.empty())
{
scc[s.top()]=cnt; W[cnt]+=w[s.top()];
vis[s.top()]=0; s.pop();
}
}
```
这个在for循环外面
by 过往梦魇之殇 @ 2020-04-18 11:14:02
@[过往梦魇之殇](/user/115291)
谢谢!!!!!
by RefreshinglyNaive @ 2020-04-18 11:27:52
@[Marser](/user/17930)
谢谢!过了
by RefreshinglyNaive @ 2020-04-18 11:28:26