Cod sursa(job #1232323)

Utilizator vlady1997Vlad Bucur vlady1997 Data 22 septembrie 2014 18:06:41
Problema BFS - Parcurgere in latime Scor 0
Compilator cpp Status done
Runda Arhiva educationala Marime 1.3 kb
        #include <cstdio>
        #include <cstring>
        #include <vector>
        #define pb push_back
        using namespace std;
        vector <int> g[100001];
        int a[100001], n, m;
        bool sel[100001];
        int bfs (int x, int y)
        {
            int p=1, u=1, i, nod;
            while (p<=u)
            {
                nod=a[p];
                for (i=1; i<=n; i++)
                {

                }
            }
        }
        int main()
        {
            int x, y, i, p;
            freopen("dfs.in","r",stdin);
            freopen("dfs.out","w",stdout);
            scanf("%d%d%d",&n,&m,&p);
            for (i=1; i<=m; i++)
            {
                scanf("%d%d",&x,&y);
                g[x].pb(y);
                if (x==p)
                {
                    a[++lg]=y;
                }
                nr[x]++;
            }
            for (i=1; i<=n; i++)
            {
                if (i==p)
                {
                    printf("0 ");
                }
                else
                {
                    memset(sel,false,sizeof(sel));
                    printf("%d ",bfs(i,p));
                }
            }
            fclose(stdin);
            fclose(stdout);
            return 0;
        }