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_20614287_10685.cpp:2:6: error: 'Q' does not name a type
      Q;    Q.push(status(s.x,s.y,0));    while(!Q.empty())    {        status t=Q.front();Q.pop();        for(int s=0;s<4;s++)        {            int X=t.x+dir[s][0],Y=t.y+dir[s][1];            if(X<1||X>n||Y<1||Y>m||vis[X][Y]) continue;            vis[X][Y]=true;            if(X==e.x&&Y==e.y) return t.dep+1;            Q.push(status(X,Y,t.dep+1));        }    }}int main(){    while(scanf("%d%d",&n,&m)!=EOF)    {        vector<status> stone;        stone.push_back(status(1,1,0));        for(int i=1;i<=n;i++)          for(int j=1;j<=m;j++)            {               scanf("%d",&g);               if(i==1&&j==1) continue;               if(g) stone.push_back(status(i,j,0));            }        for(int i=0;i<stone.size();i++)        {            for(int j=0;j<stone.size();j++)            {                if(i==j) dis[i][j]=0;                else {if(!dis[i][j]) dis[i][j]=dis[j][i]=bfs(stone[i],stone[j]);}            }        }        int s=stone.size();        int cnt=1<<s;        for(int i=0;i<cnt;i++)        {            for(int j=0;j<s;j++)            {                if(!i&(1<<j)) continue;                if(i==(1<<j)) dp[i][j]=dis[0][j];                else                {                    dp[i][j]=inf;                    for(int k=0;k<s;k++) if(i&(1<<k)&&k!=j) dp[i][j]=min(dp[i][j],dp[i^(1<<j)][k]+dis[k][j]);                }            }        }        int ans=inf;        for(int i=0;i<s;i++)            ans=min(ans,dp[cnt-1][i]+dis[i][0]);        printf("%d\n",ans);        memset(dp,0,sizeof(dp));        memset(dis,0,sizeof(dis));    }}
      ^
0_0_20614287_10685.cpp:2:12: error: 'Q' does not name a type
      Q;    Q.push(status(s.x,s.y,0));    while(!Q.empty())    {        status t=Q.front();Q.pop();        for(int s=0;s<4;s++)        {            int X=t.x+dir[s][0],Y=t.y+dir[s][1];            if(X<1||X>n||Y<1||Y>m||vis[X][Y]) continue;            vis[X][Y]=true;            if(X==e.x&&Y==e.y) return t.dep+1;            Q.push(status(X,Y,t.dep+1));        }    }}int main(){    while(scanf("%d%d",&n,&m)!=EOF)    {        vector<status> stone;        stone.push_back(status(1,1,0));        for(int i=1;i<=n;i++)          for(int j=1;j<=m;j++)            {               scanf("%d",&g);               if(i==1&&j==1) continue;               if(g) stone.push_back(status(i,j,0));            }        for(int i=0;i<stone.size();i++)        {            for(int j=0;j<stone.size();j++)            {                if(i==j) dis[i][j]=0;                else {if(!dis[i][j]) dis[i][j]=dis[j][i]=bfs(stone[i],stone[j]);}            }        }        int s=stone.size();        int cnt=1<<s;        for(int i=0;i<cnt;i++)        {            for(int j=0;j<s;j++)            {                if(!i&(1<<j)) continue;                if(i==(1<<j)) dp[i][j]=dis[0][j];                else                {                    dp[i][j]=inf;                    for(int k=0;k<s;k++) if(i&(1<<k)&&k!=j) dp[i][j]=min(dp[i][j],dp[i^(1<<j)][k]+dis[k][j]);                }            }        }        int ans=inf;        for(int i=0;i<s;i++)            ans=min(ans,dp[cnt-1][i]+dis[i][0]);        printf("%d\n",ans);        memset(dp,0,sizeof(dp));        memset(dis,0,sizeof(dis));    }}
            ^
0_0_20614287_10685.cpp:2:42: error: expected unqualified-id before 'while'
      Q;    Q.push(status(s.x,s.y,0));    while(!Q.empty())    {        status t=Q.front();Q.pop();        for(int s=0;s<4;s++)        {            int X=t.x+dir[s][0],Y=t.y+dir[s][1];            if(X<1||X>n||Y<1||Y>m||vis[X][Y]) continue;            vis[X][Y]=true;            if(X==e.x&&Y==e.y) return t.dep+1;            Q.push(status(X,Y,t.dep+1));        }    }}int main(){    while(scanf("%d%d",&n,&m)!=EOF)    {        vector<status> stone;        stone.push_back(status(1,1,0));        for(int i=1;i<=n;i++)          for(int j=1;j<=m;j++)            {               scanf("%d",&g);               if(i==1&&j==1) continue;               if(g) stone.push_back(status(i,j,0));            }        for(int i=0;i<stone.size();i++)        {            for(int j=0;j<stone.size();j++)            {                if(i==j) dis[i][j]=0;                else {if(!dis[i][j]) dis[i][j]=dis[j][i]=bfs(stone[i],stone[j]);}            }        }        int s=stone.size();        int cnt=1<<s;        for(int i=0;i<cnt;i++)        {            for(int j=0;j<s;j++)            {                if(!i&(1<<j)) continue;                if(i==(1<<j)) dp[i][j]=dis[0][j];                else                {                    dp[i][j]=inf;                    for(int k=0;k<s;k++) if(i&(1<<k)&&k!=j) dp[i][j]=min(dp[i][j],dp[i^(1<<j)][k]+dis[k][j]);                }            }        }        int ans=inf;        for(int i=0;i<s;i++)            ans=min(ans,dp[cnt-1][i]+dis[i][0]);        printf("%d\n",ans);        memset(dp,0,sizeof(dp));        memset(dis,0,sizeof(dis));    }}
                                          ^


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-15 07:15:56, Gzip enabled