F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

View Compilation Error

0_0_20612807_25789.cpp:6:25: error: stray '#' in program
     using namespace std;#define MAXN 100010int pre[MAXN],vis[MAXN],low[MAXN];vector <int> e[MAXN];int bfs1(int st,int et){    queue <int> q;    q.push(st);    vis[st]=1;pre[st]=-1;    while(!q.empty()){        int now=q.front();        q.pop();        for(int i=e[now].size()-1;i>=0;i--){            int next=e[now][i];            if(vis[next])continue;            vis[next]=1;            pre[next]=now;            if(next==et)return 1;            q.push(next);        }    }    return 0;}int bfs2(int u){    queue <int> q;    q.push(u);    int res=u;    vis[u]=1;    while(!q.empty()){        int now=q.front();        q.pop();        for(int i=e[now].size()-1;i>=0;i--){            int next=e[now][i];            if(vis[next])continue;            vis[next]=1;            if(low[next]==0)q.push(next);            else if(low[next]<low[res])res=next;        }    }    return res;}int main(){    int n,m,st,et;    while(~scanf("%d%d",&n,&m)){        for(int i=0;i<=n;i++)        e[i].clear();        memset(vis,0,sizeof(vis));        memset(low,0,sizeof(low));         for(int i=0,x,y;i<m;i++){            scanf("%d%d",&x,&y);            e[x].push_back(y);        }        scanf("%d%d",&st,&et);        if(!bfs1(st,et)){            printf("%d\n",n);            continue;        }         int u=et,tot=1;        memset(vis,0,sizeof(vis));        while(u!=-1){            low[u]=tot++;            u=pre[u];        }        int cnt=1;        u=st;        while(u!=et){            u=bfs2(u);            ++cnt;        }        printf("%d\n",cnt);    }    return 0;}
                         ^
0_0_20612807_25789.cpp:6:26: error: 'define' does not name a type
     using namespace std;#define MAXN 100010int pre[MAXN],vis[MAXN],low[MAXN];vector <int> e[MAXN];int bfs1(int st,int et){    queue <int> q;    q.push(st);    vis[st]=1;pre[st]=-1;    while(!q.empty()){        int now=q.front();        q.pop();        for(int i=e[now].size()-1;i>=0;i--){            int next=e[now][i];            if(vis[next])continue;            vis[next]=1;            pre[next]=now;            if(next==et)return 1;            q.push(next);        }    }    return 0;}int bfs2(int u){    queue <int> q;    q.push(u);    int res=u;    vis[u]=1;    while(!q.empty()){        int now=q.front();        q.pop();        for(int i=e[now].size()-1;i>=0;i--){            int next=e[now][i];            if(vis[next])continue;            vis[next]=1;            if(low[next]==0)q.push(next);            else if(low[next]<low[res])res=next;        }    }    return res;}int main(){    int n,m,st,et;    while(~scanf("%d%d",&n,&m)){        for(int i=0;i<=n;i++)        e[i].clear();        memset(vis,0,sizeof(vis));        memset(low,0,sizeof(low));         for(int i=0,x,y;i<m;i++){            scanf("%d%d",&x,&y);            e[x].push_back(y);        }        scanf("%d%d",&st,&et);        if(!bfs1(st,et)){            printf("%d\n",n);            continue;        }         int u=et,tot=1;        memset(vis,0,sizeof(vis));        while(u!=-1){            low[u]=tot++;            u=pre[u];        }        int cnt=1;        u=st;        while(u!=et){            u=bfs2(u);            ++cnt;        }        printf("%d\n",cnt);    }    return 0;}
                          ^
0_0_20612807_25789.cpp:6:93: error: 'MAXN' was not declared in this scope
     using namespace std;#define MAXN 100010int pre[MAXN],vis[MAXN],low[MAXN];vector <int> e[MAXN];int bfs1(int st,int et){    queue <int> q;    q.push(st);    vis[st]=1;pre[st]=-1;    while(!q.empty()){        int now=q.front();        q.pop();        for(int i=e[now].size()-1;i>=0;i--){            int next=e[now][i];            if(vis[next])continue;            vis[next]=1;            pre[next]=now;            if(next==et)return 1;            q.push(next);        }    }    return 0;}int bfs2(int u){    queue <int> q;    q.push(u);    int res=u;    vis[u]=1;    while(!q.empty()){        int now=q.front();        q.pop();        for(int i=e[now].size()-1;i>=0;i--){            int next=e[now][i];            if(vis[next])continue;            vis[next]=1;            if(low[next]==0)q.push(next);            else if(low[next]<low[res])res=next;        }    }    return res;}int main(){    int n,m,st,et;    while(~scanf("%d%d",&n,&m)){        for(int i=0;i<=n;i++)        e[i].clear();        memset(vis,0,sizeof(vis));        memset(low,0,sizeof(low));         for(int i=0,x,y;i<m;i++){            scanf("%d%d",&x,&y);            e[x].push_back(y);        }        scanf("%d%d",&st,&et);        if(!bfs1(st,et)){            printf("%d\n",n);            continue;        }         int u=et,tot=1;        memset(vis,0,sizeof(vis));        while(u!=-1){            low[u]=tot++;            u=pre[u];        }        int cnt=1;        u=st;        while(u!=et){            u=bfs2(u);            ++cnt;        }        printf("%d\n",cnt);    }    return 0;}
                                                                                             ^
0_0_20612807_25789.cpp: In function 'int bfs1(int, int)':
0_0_20612807_25789.cpp:6:160: error: 'vis' was not declared in this scope
     using namespace std;#define MAXN 100010int pre[MAXN],vis[MAXN],low[MAXN];vector <int> e[MAXN];int bfs1(int st,int et){    queue <int> q;    q.push(st);    vis[st]=1;pre[st]=-1;    while(!q.empty()){        int now=q.front();        q.pop();        for(int i=e[now].size()-1;i>=0;i--){            int next=e[now][i];            if(vis[next])continue;            vis[next]=1;            pre[next]=now;            if(next==et)return 1;            q.push(next);        }    }    return 0;}int bfs2(int u){    queue <int> q;    q.push(u);    int res=u;    vis[u]=1;    while(!q.empty()){        int now=q.front();        q.pop();        for(int i=e[now].size()-1;i>=0;i--){            int next=e[now][i];            if(vis[next])continue;            vis[next]=1;            if(low[next]==0)q.push(next);            else if(low[next]<low[res])res=next;        }    }    return res;}int main(){    int n,m,st,et;    while(~scanf("%d%d",&n,&m)){        for(int i=0;i<=n;i++)        e[i].clear();        memset(vis,0,sizeof(vis));        memset(low,0,sizeof(low));         for(int i=0,x,y;i<m;i++){            scanf("%d%d",&x,&y);            e[x].push_back(y);        }        scanf("%d%d",&st,&et);        if(!bfs1(st,et)){            printf("%d\n",n);            continue;        }         int u=et,tot=1;        memset(vis,0,sizeof(vis));        while(u!=-1){            low[u]=tot++;            u=pre[u];        }        int cnt=1;        u=st;        while(u!=et){            u=bfs2(u);            ++cnt;        }        printf("%d\n",cnt);    }    return 0;}
                                                                                                                                                                ^
0_0_20612807_25789.cpp:6:170: error: 'pre' was not declared in this scope
     using namespace std;#define MAXN 100010int pre[MAXN],vis[MAXN],low[MAXN];vector <int> e[MAXN];int bfs1(int st,int et){    queue <int> q;    q.push(st);    vis[st]=1;pre[st]=-1;    while(!q.empty()){        int now=q.front();        q.pop();        for(int i=e[now].size()-1;i>=0;i--){            int next=e[now][i];            if(vis[next])continue;            vis[next]=1;            pre[next]=now;            if(next==et)return 1;            q.push(next);        }    }    return 0;}int bfs2(int u){    queue <int> q;    q.push(u);    int res=u;    vis[u]=1;    while(!q.empty()){        int now=q.front();        q.pop();        for(int i=e[now].size()-1;i>=0;i--){            int next=e[now][i];            if(vis[next])continue;            vis[next]=1;            if(low[next]==0)q.push(next);            else if(low[next]<low[res])res=next;        }    }    return res;}int main(){    int n,m,st,et;    while(~scanf("%d%d",&n,&m)){        for(int i=0;i<=n;i++)        e[i].clear();        memset(vis,0,sizeof(vis));        memset(low,0,sizeof(low));         for(int i=0,x,y;i<m;i++){            scanf("%d%d",&x,&y);            e[x].push_back(y);        }        scanf("%d%d",&st,&et);        if(!bfs1(st,et)){            printf("%d\n",n);            continue;        }         int u=et,tot=1;        memset(vis,0,sizeof(vis));        while(u!=-1){            low[u]=tot++;            u=pre[u];        }        int cnt=1;        u=st;        while(u!=et){            u=bfs2(u);            ++cnt;        }        printf("%d\n",cnt);    }    return 0;}
                                                                                                                                                                          ^
0_0_20612807_25789.cpp:6:263: error: 'e' was not declared in this scope
     using namespace std;#define MAXN 100010int pre[MAXN],vis[MAXN],low[MAXN];vector <int> e[MAXN];int bfs1(int st,int et){    queue <int> q;    q.push(st);    vis[st]=1;pre[st]=-1;    while(!q.empty()){        int now=q.front();        q.pop();        for(int i=e[now].size()-1;i>=0;i--){            int next=e[now][i];            if(vis[next])continue;            vis[next]=1;            pre[next]=now;            if(next==et)return 1;            q.push(next);        }    }    return 0;}int bfs2(int u){    queue <int> q;    q.push(u);    int res=u;    vis[u]=1;    while(!q.empty()){        int now=q.front();        q.pop();        for(int i=e[now].size()-1;i>=0;i--){            int next=e[now][i];            if(vis[next])continue;            vis[next]=1;            if(low[next]==0)q.push(next);            else if(low[next]<low[res])res=next;        }    }    return res;}int main(){    int n,m,st,et;    while(~scanf("%d%d",&n,&m)){        for(int i=0;i<=n;i++)        e[i].clear();        memset(vis,0,sizeof(vis));        memset(low,0,sizeof(low));         for(int i=0,x,y;i<m;i++){            scanf("%d%d",&x,&y);            e[x].push_back(y);        }        scanf("%d%d",&st,&et);        if(!bfs1(st,et)){            printf("%d\n",n);            continue;        }         int u=et,tot=1;        memset(vis,0,sizeof(vis));        while(u!=-1){            low[u]=tot++;            u=pre[u]


Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-12-02 12:08:58, Gzip enabled