当前位置: 首页 > news >正文

图的易错点

处理多组图时 vector<pair<int,int>>e[N]需要在每次新建图时清空

/*错误操作:
*/
e.clear();/*
正确操作:
*/
for(int i=1;i<=n;i++){e[i].clear();
}