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_20614589_25597.cpp:11:6: error: 'vec' does not name a type
      vec[N];bool vis[N];int dis[N];int fa[N];void relax(int x){    for(int i=0;i<vec[x].size();i++){        int v1=vec[x][i];        if(!vis[v1] && !fa[v1]) fa[v1]=x;    }}int main(){    int T;    scanf("%d",&T);   while(T--){        scanf("%d%d",&n,&m);        for(int i=1;i<=n;i++) vec[i].clear();        for(int i=1;i<=n;i++) vis[i]=false,fa[i]=0;        for(int i=1;i<=m;i++){            scanf("%d%d",u+i,v+i);            vec[u[i]].push_back(v[i]);        }        vis[1]=true;        dis[1]=0;        fa[1]=-1;        int now=1;        int pre=2,last=n;        relax(1);        while(pre<=last){            if(fa[pre]){                dis[pre]=now++;                vis[pre]=true;                relax(pre);                pre++;                continue;            }            if(fa[last]){                dis[last]=now++;                vis[last]=true;                relax(last);                last--;                continue;            }        }        for(int i=1;i<=m;i++){            if(fa[v[i]]!=u[i]) printf("%d\n",n);            else printf("%d\n",dis[v[i]]-dis[u[i]]);        }   }    return 0;}
      ^
0_0_20614589_25597.cpp:11:22: error: 'N' was not declared in this scope
      vec[N];bool vis[N];int dis[N];int fa[N];void relax(int x){    for(int i=0;i<vec[x].size();i++){        int v1=vec[x][i];        if(!vis[v1] && !fa[v1]) fa[v1]=x;    }}int main(){    int T;    scanf("%d",&T);   while(T--){        scanf("%d%d",&n,&m);        for(int i=1;i<=n;i++) vec[i].clear();        for(int i=1;i<=n;i++) vis[i]=false,fa[i]=0;        for(int i=1;i<=m;i++){            scanf("%d%d",u+i,v+i);            vec[u[i]].push_back(v[i]);        }        vis[1]=true;        dis[1]=0;        fa[1]=-1;        int now=1;        int pre=2,last=n;        relax(1);        while(pre<=last){            if(fa[pre]){                dis[pre]=now++;                vis[pre]=true;                relax(pre);                pre++;                continue;            }            if(fa[last]){                dis[last]=now++;                vis[last]=true;                relax(last);                last--;                continue;            }        }        for(int i=1;i<=m;i++){            if(fa[v[i]]!=u[i]) printf("%d\n",n);            else printf("%d\n",dis[v[i]]-dis[u[i]]);        }   }    return 0;}
                      ^
0_0_20614589_25597.cpp:11:33: error: 'N' was not declared in this scope
      vec[N];bool vis[N];int dis[N];int fa[N];void relax(int x){    for(int i=0;i<vec[x].size();i++){        int v1=vec[x][i];        if(!vis[v1] && !fa[v1]) fa[v1]=x;    }}int main(){    int T;    scanf("%d",&T);   while(T--){        scanf("%d%d",&n,&m);        for(int i=1;i<=n;i++) vec[i].clear();        for(int i=1;i<=n;i++) vis[i]=false,fa[i]=0;        for(int i=1;i<=m;i++){            scanf("%d%d",u+i,v+i);            vec[u[i]].push_back(v[i]);        }        vis[1]=true;        dis[1]=0;        fa[1]=-1;        int now=1;        int pre=2,last=n;        relax(1);        while(pre<=last){            if(fa[pre]){                dis[pre]=now++;                vis[pre]=true;                relax(pre);                pre++;                continue;            }            if(fa[last]){                dis[last]=now++;                vis[last]=true;                relax(last);                last--;                continue;            }        }        for(int i=1;i<=m;i++){            if(fa[v[i]]!=u[i]) printf("%d\n",n);            else printf("%d\n",dis[v[i]]-dis[u[i]]);        }   }    return 0;}
                                 ^
0_0_20614589_25597.cpp:11:43: error: 'N' was not declared in this scope
      vec[N];bool vis[N];int dis[N];int fa[N];void relax(int x){    for(int i=0;i<vec[x].size();i++){        int v1=vec[x][i];        if(!vis[v1] && !fa[v1]) fa[v1]=x;    }}int main(){    int T;    scanf("%d",&T);   while(T--){        scanf("%d%d",&n,&m);        for(int i=1;i<=n;i++) vec[i].clear();        for(int i=1;i<=n;i++) vis[i]=false,fa[i]=0;        for(int i=1;i<=m;i++){            scanf("%d%d",u+i,v+i);            vec[u[i]].push_back(v[i]);        }        vis[1]=true;        dis[1]=0;        fa[1]=-1;        int now=1;        int pre=2,last=n;        relax(1);        while(pre<=last){            if(fa[pre]){                dis[pre]=now++;                vis[pre]=true;                relax(pre);                pre++;                continue;            }            if(fa[last]){                dis[last]=now++;                vis[last]=true;                relax(last);                last--;                continue;            }        }        for(int i=1;i<=m;i++){            if(fa[v[i]]!=u[i]) printf("%d\n",n);            else printf("%d\n",dis[v[i]]-dis[u[i]]);        }   }    return 0;}
                                           ^
0_0_20614589_25597.cpp: In function 'void relax(int)':
0_0_20614589_25597.cpp:11:82: error: 'vec' was not declared in this scope
      vec[N];bool vis[N];int dis[N];int fa[N];void relax(int x){    for(int i=0;i<vec[x].size();i++){        int v1=vec[x][i];        if(!vis[v1] && !fa[v1]) fa[v1]=x;    }}int main(){    int T;    scanf("%d",&T);   while(T--){        scanf("%d%d",&n,&m);        for(int i=1;i<=n;i++) vec[i].clear();        for(int i=1;i<=n;i++) vis[i]=false,fa[i]=0;        for(int i=1;i<=m;i++){            scanf("%d%d",u+i,v+i);            vec[u[i]].push_back(v[i]);        }        vis[1]=true;        dis[1]=0;        fa[1]=-1;        int now=1;        int pre=2,last=n;        relax(1);        while(pre<=last){            if(fa[pre]){                dis[pre]=now++;                vis[pre]=true;                relax(pre);                pre++;                continue;            }            if(fa[last]){                dis[last]=now++;                vis[last]=true;                relax(last);                last--;                continue;            }        }        for(int i=1;i<=m;i++){            if(fa[v[i]]!=u[i]) printf("%d\n",n);            else printf("%d\n",dis[v[i]]-dis[u[i]]);        }   }    return 0;}
                                                                                  ^
0_0_20614589_25597.cpp:11:138: error: 'vis' was not declared in this scope
      vec[N];bool vis[N];int dis[N];int fa[N];void relax(int x){    for(int i=0;i<vec[x].size();i++){        int v1=vec[x][i];        if(!vis[v1] && !fa[v1]) fa[v1]=x;    }}int main(){    int T;    scanf("%d",&T);   while(T--){        scanf("%d%d",&n,&m);        for(int i=1;i<=n;i++) vec[i].clear();        for(int i=1;i<=n;i++) vis[i]=false,fa[i]=0;        for(int i=1;i<=m;i++){            scanf("%d%d",u+i,v+i);            vec[u[i]].push_back(v[i]);        }        vis[1]=true;        dis[1]=0;        fa[1]=-1;        int now=1;        int pre=2,last=n;        relax(1);        while(pre<=last){            if(fa[pre]){                dis[pre]=now++;                vis[pre]=true;                relax(pre);                pre++;                continue;            }            if(fa[last]){                dis[last]=now++;                vis[last]=true;                relax(last);                last--;                continue;            }        }        for(int i=1;i<=m;i++){            if(fa[v[i]]!=u[i]) printf("%d\n",n);            else printf("%d\n",dis[v[i]]-dis[u[i]]);        }   }    return 0;}
                                                                                                                                          ^
0_0_20614589_25597.cpp:11:150: error: 'fa' was not declared in this scope
      vec[N];bool vis[N];int dis[N];int fa[N];void relax(int x){    for(int i=0;i<vec[x].size();i++){        int v1=vec[x][i];        if(!vis[v1] && !fa[v1]) fa[v1]=x;    }}int main(){    int T;    scanf("%d",&T);   while(T--){        scanf("%d%d",&n,&m);        for(int i=1;i<=n;i++) vec[i].clear();        for(int i=1;i<=n;i++) vis[i]=false,fa[i]=0;        for(int i=1;i<=m;i++){            scanf("%d%d",u+i,v+i);            vec[u[i]].push_back(v[i]);        }        vis[1]=true;        dis[1]=0;        fa[1]=-1;        int now=1;        int pre=2,last=n;        relax(1);        while(pre<=last){            if(fa[pre]){                dis[pre]=now++;                vis[pre]=true;                relax(pre);                pre++;                continue;            }            if(fa[last]){                dis[last]=now++;                vis[last]=true;                relax(last);                last--;                continue;            }        }        for(int i=1;i<=m;i++){            if(fa[v[i]]!=u[i]) printf("%d\n",n);            else printf("%d\n",dis[v[i]]-dis[u[i]]);        }   }    return 0;}
                                                                                                                                                      ^
0_0_20614589_25597.cpp: In function 'int main()':
0_0_20614589_25597.cpp:11:249: error: 'n' was not declared in this scope
      vec[N];bool vis[N];int dis[N];int fa[N];void relax(int x){    for(int i=0;i<vec[x].size();i++){        int v1=vec[x][i];        if(!vis[v1] && !fa[v1]) fa[v1]=x;    }}int main(){    int T;    scanf("%d",&T);   while(T--){        scanf("%d%d",&n,&m);        for(int i=1;i<=n;i++) vec[i].clear();        for(int i=1;i<=n;i++) vis[i]=false,fa[i]=0;        for(int i=1;i<=m;i++){            scanf("%d%d",u+i,v+i);            vec[u[i]].push_back(v[i]);        }        vis[1]=true;        dis[1]=0;        fa[1]=-1;        int now=1;        int pre=2,last=n;        relax(1);        while(pre<=last){            if(fa[pre]){                dis[pre]=now++;                vis[pre]=true;                relax(pre);                pre++;                continue;            }            if(fa[last]){                dis[last]=now++;                vis[last]=true;                relax(last);                last--;                continue;            }        }        for(int i=1;i<=m;i++){            if(fa[v[i]]!=u[i]) printf("%d\n",n);            else printf("%d\n",dis[v[i]]-dis[u[i]]);        }   }    return 0;}
                               


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-11-24 14:45:43, Gzip enabled