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_20612108_8197.cpp:7:6: error: 'map' does not name a type
      map[maxn];bool vis[maxn];int solve(){    queue <int> q;    memset(vis,0,sizeof(vis));    memset(pre,0,sizeof(pre));    vis[1] = 1;    q.push(1);    int ans = 0;    while(!q.empty()){        int now = q.front();        q.pop();        for(int i = 0; i < map[now].size(); i ++)            pre[map[now][i]] = now;        for(int i = 1; i <= n;i ++)            if(!vis[i] && pre[i] != now)                vis[i] = true, q.push(i),ans ++;    }    return ans;}int main(){    int ca = 1;    while(~scanf("%d%d",&n,&m) && (n || m)){        for(int i = 1; i <= n; i ++)            map[i].clear();        for(int i = 0; i < m; i ++){            scanf("%d%d",&a,&b);            map[a].push_back(b);            map[b].push_back(a);        }        printf("Case %d: %d\n",ca ++ ,solve());    }    return 0;}
      ^
0_0_20612108_8197.cpp:6:63: error: 'maxn' was not declared in this scope
     #define maxn 10010using namespace std;int n,m,a,b;int pre[maxn];vector <int>
                                                               ^
0_0_20612108_8197.cpp:7:10: note: in expansion of macro 'maxn'
      map[maxn];bool vis[maxn];int solve(){    queue <int> q;    memset(vis,0,sizeof(vis));    memset(pre,0,sizeof(pre));    vis[1] = 1;    q.push(1);    int ans = 0;    while(!q.empty()){        int now = q.front();        q.pop();        for(int i = 0; i < map[now].size(); i ++)            pre[map[now][i]] = now;        for(int i = 1; i <= n;i ++)            if(!vis[i] && pre[i] != now)                vis[i] = true, q.push(i),ans ++;    }    return ans;}int main(){    int ca = 1;    while(~scanf("%d%d",&n,&m) && (n || m)){        for(int i = 1; i <= n; i ++)            map[i].clear();        for(int i = 0; i < m; i ++){            scanf("%d%d",&a,&b);            map[a].push_back(b);            map[b].push_back(a);        }        printf("Case %d: %d\n",ca ++ ,solve());    }    return 0;}
          ^
0_0_20612108_8197.cpp:6:69: error: 'vector' does not name a type
     #define maxn 10010using namespace std;int n,m,a,b;int pre[maxn];vector <int>
                                                                     ^
0_0_20612108_8197.cpp:7:10: note: in expansion of macro 'maxn'
      map[maxn];bool vis[maxn];int solve(){    queue <int> q;    memset(vis,0,sizeof(vis));    memset(pre,0,sizeof(pre));    vis[1] = 1;    q.push(1);    int ans = 0;    while(!q.empty()){        int now = q.front();        q.pop();        for(int i = 0; i < map[now].size(); i ++)            pre[map[now][i]] = now;        for(int i = 1; i <= n;i ++)            if(!vis[i] && pre[i] != now)                vis[i] = true, q.push(i),ans ++;    }    return ans;}int main(){    int ca = 1;    while(~scanf("%d%d",&n,&m) && (n || m)){        for(int i = 1; i <= n; i ++)            map[i].clear();        for(int i = 0; i < m; i ++){            scanf("%d%d",&a,&b);            map[a].push_back(b);            map[b].push_back(a);        }        printf("Case %d: %d\n",ca ++ ,solve());    }    return 0;}
          ^
0_0_20612108_8197.cpp:6:18: error: unable to find numeric literal operator 'operator""using'
     #define maxn 10010using namespace std;int n,m,a,b;int pre[maxn];vector <int>
                  ^
0_0_20612108_8197.cpp:7:25: note: in expansion of macro 'maxn'
      map[maxn];bool vis[maxn];int solve(){    queue <int> q;    memset(vis,0,sizeof(vis));    memset(pre,0,sizeof(pre));    vis[1] = 1;    q.push(1);    int ans = 0;    while(!q.empty()){        int now = q.front();        q.pop();        for(int i = 0; i < map[now].size(); i ++)            pre[map[now][i]] = now;        for(int i = 1; i <= n;i ++)            if(!vis[i] && pre[i] != now)                vis[i] = true, q.push(i),ans ++;    }    return ans;}int main(){    int ca = 1;    while(~scanf("%d%d",&n,&m) && (n || m)){        for(int i = 1; i <= n; i ++)            map[i].clear();        for(int i = 0; i < m; i ++){            scanf("%d%d",&a,&b);            map[a].push_back(b);            map[b].push_back(a);        }        printf("Case %d: %d\n",ca ++ ,solve());    }    return 0;}
                         ^
0_0_20612108_8197.cpp:6:18: note: use -std=gnu++11 or -fext-numeric-literals to enable more built-in suffixes
     #define maxn 10010using namespace std;int n,m,a,b;int pre[maxn];vector <int>
                  ^
0_0_20612108_8197.cpp:7:25: note: in expansion of macro 'maxn'
      map[maxn];bool vis[maxn];int solve(){    queue <int> q;    memset(vis,0,sizeof(vis));    memset(pre,0,sizeof(pre));    vis[1] = 1;    q.push(1);    int ans = 0;    while(!q.empty()){        int now = q.front();        q.pop();        for(int i = 0; i < map[now].size(); i ++)            pre[map[now][i]] = now;        for(int i = 1; i <= n;i ++)            if(!vis[i] && pre[i] != now)                vis[i] = true, q.push(i),ans ++;    }    return ans;}int main(){    int ca = 1;    while(~scanf("%d%d",&n,&m) && (n || m)){        for(int i = 1; i <= n; i ++)            map[i].clear();        for(int i = 0; i < m; i ++){            scanf("%d%d",&a,&b);            map[a].push_back(b);            map[b].push_back(a);        }        printf("Case %d: %d\n",ca ++ ,solve());    }    return 0;}
                         ^
0_0_20612108_8197.cpp:6:29: error: expected ']' before 'namespace'
     #define maxn 10010using namespace std;int n,m,a,b;int pre[maxn];vector <int>
                             ^
0_0_20612108_8197.cpp:7:25: note: in expansion of macro 'maxn'
      map[maxn];bool vis[maxn];int solve(){    queue <int> q;    memset(vis,0,sizeof(vis));    memset(pre,0,sizeof(pre));    vis[1] = 1;    q.push(1);    int ans = 0;    while(!q.empty()){        int now = q.front();        q.pop();        for(int i = 0; i < map[now].size(); i ++)            pre[map[now][i]] = now;        for(int i = 1; i <= n;i ++)            if(!vis[i] && pre[i] != now)                vis[i] = true, q.push(i),ans ++;    }    return ans;}int main(){    int ca = 1;    while(~scanf("%d%d",&n,&m) && (n || m)){        for(int i = 1; i <= n; i ++)            map[i].clear();        for(int i = 0; i < m; i ++){            scanf("%d%d",&a,&b);            map[a].push_back(b);            map[b].push_back(a);        }        printf("Case %d: %d\n",ca ++ ,solve());    }    return 0;}
                         ^
0_0_20612108_8197.cpp:6:47: error: redefinition of 'int n'
     #define maxn 10010using namespace std;int n,m,a,b;int pre[maxn];vector <int>
                                               ^
0_0_20612108_8197.cpp:7:25: note: in expansion of macro 'maxn'
      map[maxn];bool vis[maxn];int solve(){    queue <int> q;    memset(vis,0,sizeof(vis));    memset(pre,0,sizeof(pre));    vis[1] = 1;    q.push(1);    int ans = 0;    while(!q.empty()){        int now = q.front();        q.pop();        for(int i = 0; i < map[now].size(); i ++)            pre[map[now][i]] = now;        for(int i = 1; i <= n;i ++)            if(!vis[i] && pre[i] != now)                vis[i] = true, q.push(i),ans ++;    }    return ans;}int main(){    int ca = 1;    while(~scanf("%d%d",&n,&m) && (n || m)){        for(int i = 1; i <= n; i ++)            map[i].clear();        for(int i = 0; i < m; i ++){            scanf("%d%d",&a,&b);            map[a].push_back(b);            map[b].push_back(a);        }        printf("Case %d: %d\n",ca ++ ,solve());    }    return 0;}
                         ^
0_0_20612108_8197.cpp:6:47: note: 'int n' previously declared here
     #define maxn 10010using namespace std;int n,m,a,b;int pre[maxn];vector <int>
                                               ^
0_0_20612108_8197.cpp:7:10: note: in expansion of macro 'maxn'
      map[maxn];bool vis[maxn];int solve(){    queue <int> q;    memset(vis,0,sizeof(vis));    memset(pre,0,sizeof(pre));    vis[1] = 1;    q.push(1);    int ans = 0;    while(!q.empty()){        int now = q.front();        q.pop();        for(int i = 0; i < map[now].size(); i ++)            pre[map[now][i]] = now;        for(int i = 1; i <= n;i ++)            if(!vis[i] && pre[i] != now)                vis[i] = true, q.push(i),ans ++;    }    return ans;}int main(){    int ca = 1;    while(~scanf("%d%d",&n,&m) && (n || m)){        for(int i = 1; i <= n; i ++)            map[i].clear();        for(int i = 0; i < m; i ++){            scanf("%d%d",&a,&b);            map[a].push_back(b);            map[b].push_back(a);        }        printf("Case %d: %d\n",ca ++ ,solve());    }    return 0;}
          ^
0_0_20612108_8197.cpp:6:49: error: redefinition of 'int m'
     #define maxn 10010using namespace std;int n,m,a,b;int pre[maxn];vector <int>
                                                 ^
0_0_20612108_8197.cpp:7:25: note: in expansion of macro 'maxn'
      map[maxn];bool vis[maxn];int solve(){    queue <int> q;    memset(vis,0,sizeof(vis));    memset(pre,0,sizeof(pre));    vis[1] = 1;    q.push(1);    int ans = 0;    while(!q.empty()){        int now = q.front();        q.pop();        for(int i = 0; i < map[now].size(); i ++)            pre[map[now][i]] = now;        for(int i = 1; i <= n;i ++)            if(!vis[i] && pre[i] != now)                vis[i] = true, q.push(i),ans ++;    }    return ans;}int main(){    int ca = 1;    while(~scanf("%d%d",&n,&m) && (n || m)){        for(int i = 1; i <= n; i ++)            map[i].clear();        for(int i = 0; i < m; i ++){            scanf("%d%d",&a,&b);            map[a].push_back(b);            map[b].push_back(a);        }        printf("Case %d: %d\n",ca ++ ,solve());    }    return 0;}
                         ^
0_0_20612108_8197.cpp:6:49: note: 'int m' previously declared here
     #define maxn 10010using namespace std;int n,m,a,b;int pre[maxn];vector <int>
                                                 ^
0_0_20612108_8197.cpp:7:10: note: in expansion of macro 'maxn'
      map[maxn];bool vis[maxn];int solve(){    queue <int> q;    memset(vis,0,sizeof(vis));    memset(pre,0,sizeof(pre));    vis[1] = 1;    q.push(1);    int ans = 0;    while(!q.empty()){        int now = q.fron


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-17 10:27:26, Gzip enabled