版本比较

标识

  • 该行被添加。
  • 该行被删除。
  • 格式已经改变。

...

和,差,商,积:sum, diff, quot(ient), prod(uct)


邻接数组形式的bfs模板:

代码块
vector<int> visited;

void bfs(vector<vector<int>> &graph, int start) {
    queue<int> q;
    q.push(start);
    visited[start] = 1;
    
    while(!q.empty()) {
        int size = q.size();
        while(size-- > 0) {
            int cur = q.front(); q.pop();
            visited[cur] = 1;
            for(auto nxt : graph[n]) {
                if(!visited[nxt]) {
                    q.push(nxt);
                    visited[nxt] = 1;
                }
            }
        }
    }
}