1076 Forwards on Weibo(30 分)

#include 
#include 
#include 
#include 
#include
using namespace std;
vector in, level;
#define C(X) cout<> v;
vector visit;
struct node
{
    int data;
    int layer;
    node() {}
    node(int a, int b)
    {
        data = a;
        layer = b;
    }
};

int bfs(node inp)
{
    fill(visit.begin(), visit.end(), false);
    queueq;
    visit[inp.data] = true;
    int cnt = 0;
    q.push(inp);
    while (!q.empty())
    {
        node temp = q.front();
        q.pop();
        int nextid = temp.data;
        for (int i = 0; i < v[nextid].size(); i++)
        {
            if (visit[v[nextid][i]] == false&&temp.layer> M >> N;
    v.resize(M+1);
    visit.resize(M, false);
    for (int i = 1; i <= M; i++)
    {
        cin >> T;
        for (int j = 0; j < T; j++)
        {
            cin >> a;
            v[a].push_back(i);
        }
    }

    cin >> L;
    for (int i = 0; i < L; i++)
    {
        cin >> c;
        /*node n(c, 0);
        int cnt = bfs(n);*/
        C(6);
        C(8);

    }

    ST;
    return 0;
}

你可能感兴趣的:(1076 Forwards on Weibo(30 分))