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_20614057_22779.cpp:5:25: error: stray '#' in program
     using namespace std;#define maxn 50050int dp[maxn][2];int n,X,Y;bool state;int v[maxn],f,s[maxn],p;struct node{    int t,nxt;}edge[maxn<<1];int head[maxn];bool vis[maxn];void solve(int u){    vis[u] = 1;    if(s[u])state ^= 1;    if(state)v[u] = -v[u];    dp[u][0] = v[u];    dp[u][1] = -v[u];    for (int i = head[u]; i!=-1; i = edge[i].nxt)    {        int y = edge[i].t;        if(!vis[y]){        solve(y);        dp[u][0] += max(dp[y][0],dp[y][1]-(s[y]?Y:X));        dp[u][1] += max(dp[y][1],dp[y][0]-(s[y]?Y:X));        }    }    if(s[u]) state ^= 1;}int main(){    while(scanf("%d%d%d",&n,&X,&Y)!=EOF)    {        memset(dp,0,sizeof(dp));        memset(head,-1,sizeof(head));        memset(vis,0,sizeof(vis));        int ind = 0;        state = 0;        for (int i = 1; i <= n; i++)        {            scanf("%d%d%d%d",&v[i],&f,&s[i],&p);            if(p) v[i] = -v[i];            edge[ind].t = i;            edge[ind].nxt = head[f];            head[f] = ind++;        }        solve(0);        if(dp[0][0] < 0)            puts("HAHAHAOMG");        else printf("%d\n",dp[0][0]);    }    return 0;}
                         ^
0_0_20614057_22779.cpp:5:26: error: 'define' does not name a type
     using namespace std;#define maxn 50050int dp[maxn][2];int n,X,Y;bool state;int v[maxn],f,s[maxn],p;struct node{    int t,nxt;}edge[maxn<<1];int head[maxn];bool vis[maxn];void solve(int u){    vis[u] = 1;    if(s[u])state ^= 1;    if(state)v[u] = -v[u];    dp[u][0] = v[u];    dp[u][1] = -v[u];    for (int i = head[u]; i!=-1; i = edge[i].nxt)    {        int y = edge[i].t;        if(!vis[y]){        solve(y);        dp[u][0] += max(dp[y][0],dp[y][1]-(s[y]?Y:X));        dp[u][1] += max(dp[y][1],dp[y][0]-(s[y]?Y:X));        }    }    if(s[u]) state ^= 1;}int main(){    while(scanf("%d%d%d",&n,&X,&Y)!=EOF)    {        memset(dp,0,sizeof(dp));        memset(head,-1,sizeof(head));        memset(vis,0,sizeof(vis));        int ind = 0;        state = 0;        for (int i = 1; i <= n; i++)        {            scanf("%d%d%d%d",&v[i],&f,&s[i],&p);            if(p) v[i] = -v[i];            edge[ind].t = i;            edge[ind].nxt = head[f];            head[f] = ind++;        }        solve(0);        if(dp[0][0] < 0)            puts("HAHAHAOMG");        else printf("%d\n",dp[0][0]);    }    return 0;}
                          ^
0_0_20614057_22779.cpp:5:86: error: 'maxn' was not declared in this scope
     using namespace std;#define maxn 50050int dp[maxn][2];int n,X,Y;bool state;int v[maxn],f,s[maxn],p;struct node{    int t,nxt;}edge[maxn<<1];int head[maxn];bool vis[maxn];void solve(int u){    vis[u] = 1;    if(s[u])state ^= 1;    if(state)v[u] = -v[u];    dp[u][0] = v[u];    dp[u][1] = -v[u];    for (int i = head[u]; i!=-1; i = edge[i].nxt)    {        int y = edge[i].t;        if(!vis[y]){        solve(y);        dp[u][0] += max(dp[y][0],dp[y][1]-(s[y]?Y:X));        dp[u][1] += max(dp[y][1],dp[y][0]-(s[y]?Y:X));        }    }    if(s[u]) state ^= 1;}int main(){    while(scanf("%d%d%d",&n,&X,&Y)!=EOF)    {        memset(dp,0,sizeof(dp));        memset(head,-1,sizeof(head));        memset(vis,0,sizeof(vis));        int ind = 0;        state = 0;        for (int i = 1; i <= n; i++)        {            scanf("%d%d%d%d",&v[i],&f,&s[i],&p);            if(p) v[i] = -v[i];            edge[ind].t = i;            edge[ind].nxt = head[f];            head[f] = ind++;        }        solve(0);        if(dp[0][0] < 0)            puts("HAHAHAOMG");        else printf("%d\n",dp[0][0]);    }    return 0;}
                                                                                      ^
0_0_20614057_22779.cpp:5:96: error: 'maxn' was not declared in this scope
     using namespace std;#define maxn 50050int dp[maxn][2];int n,X,Y;bool state;int v[maxn],f,s[maxn],p;struct node{    int t,nxt;}edge[maxn<<1];int head[maxn];bool vis[maxn];void solve(int u){    vis[u] = 1;    if(s[u])state ^= 1;    if(state)v[u] = -v[u];    dp[u][0] = v[u];    dp[u][1] = -v[u];    for (int i = head[u]; i!=-1; i = edge[i].nxt)    {        int y = edge[i].t;        if(!vis[y]){        solve(y);        dp[u][0] += max(dp[y][0],dp[y][1]-(s[y]?Y:X));        dp[u][1] += max(dp[y][1],dp[y][0]-(s[y]?Y:X));        }    }    if(s[u]) state ^= 1;}int main(){    while(scanf("%d%d%d",&n,&X,&Y)!=EOF)    {        memset(dp,0,sizeof(dp));        memset(head,-1,sizeof(head));        memset(vis,0,sizeof(vis));        int ind = 0;        state = 0;        for (int i = 1; i <= n; i++)        {            scanf("%d%d%d%d",&v[i],&f,&s[i],&p);            if(p) v[i] = -v[i];            edge[ind].t = i;            edge[ind].nxt = head[f];            head[f] = ind++;        }        solve(0);        if(dp[0][0] < 0)            puts("HAHAHAOMG");        else printf("%d\n",dp[0][0]);    }    return 0;}
                                                                                                ^
0_0_20614057_22779.cpp:5:136: error: 'maxn' was not declared in this scope
     using namespace std;#define maxn 50050int dp[maxn][2];int n,X,Y;bool state;int v[maxn],f,s[maxn],p;struct node{    int t,nxt;}edge[maxn<<1];int head[maxn];bool vis[maxn];void solve(int u){    vis[u] = 1;    if(s[u])state ^= 1;    if(state)v[u] = -v[u];    dp[u][0] = v[u];    dp[u][1] = -v[u];    for (int i = head[u]; i!=-1; i = edge[i].nxt)    {        int y = edge[i].t;        if(!vis[y]){        solve(y);        dp[u][0] += max(dp[y][0],dp[y][1]-(s[y]?Y:X));        dp[u][1] += max(dp[y][1],dp[y][0]-(s[y]?Y:X));        }    }    if(s[u]) state ^= 1;}int main(){    while(scanf("%d%d%d",&n,&X,&Y)!=EOF)    {        memset(dp,0,sizeof(dp));        memset(head,-1,sizeof(head));        memset(vis,0,sizeof(vis));        int ind = 0;        state = 0;        for (int i = 1; i <= n; i++)        {            scanf("%d%d%d%d",&v[i],&f,&s[i],&p);            if(p) v[i] = -v[i];            edge[ind].t = i;            edge[ind].nxt = head[f];            head[f] = ind++;        }        solve(0);        if(dp[0][0] < 0)            puts("HAHAHAOMG");        else printf("%d\n",dp[0][0]);    }    return 0;}
                                                                                                                                        ^
0_0_20614057_22779.cpp:5:154: error: 'maxn' was not declared in this scope
     using namespace std;#define maxn 50050int dp[maxn][2];int n,X,Y;bool state;int v[maxn],f,s[maxn],p;struct node{    int t,nxt;}edge[maxn<<1];int head[maxn];bool vis[maxn];void solve(int u){    vis[u] = 1;    if(s[u])state ^= 1;    if(state)v[u] = -v[u];    dp[u][0] = v[u];    dp[u][1] = -v[u];    for (int i = head[u]; i!=-1; i = edge[i].nxt)    {        int y = edge[i].t;        if(!vis[y]){        solve(y);        dp[u][0] += max(dp[y][0],dp[y][1]-(s[y]?Y:X));        dp[u][1] += max(dp[y][1],dp[y][0]-(s[y]?Y:X));        }    }    if(s[u]) state ^= 1;}int main(){    while(scanf("%d%d%d",&n,&X,&Y)!=EOF)    {        memset(dp,0,sizeof(dp));        memset(head,-1,sizeof(head));        memset(vis,0,sizeof(vis));        int ind = 0;        state = 0;        for (int i = 1; i <= n; i++)        {            scanf("%d%d%d%d",&v[i],&f,&s[i],&p);            if(p) v[i] = -v[i];            edge[ind].t = i;            edge[ind].nxt = head[f];            head[f] = ind++;        }        solve(0);        if(dp[0][0] < 0)            puts("HAHAHAOMG");        else printf("%d\n",dp[0][0]);    }    return 0;}
                                                                                                                                                          ^
0_0_20614057_22779.cpp:5:169: error: 'maxn' was not declared in this scope
     using namespace std;#define maxn 50050int dp[maxn][2];int n,X,Y;bool state;int v[maxn],f,s[maxn],p;struct node{    int t,nxt;}edge[maxn<<1];int head[maxn];bool vis[maxn];void solve(int u){    vis[u] = 1;    if(s[u])state ^= 1;    if(state)v[u] = -v[u];    dp[u][0] = v[u];    dp[u][1] = -v[u];    for (int i = head[u]; i!=-1; i = edge[i].nxt)    {        int y = edge[i].t;        if(!vis[y]){        solve(y);        dp[u][0] += max(dp[y][0],dp[y][1]-(s[y]?Y:X));        dp[u][1] += max(dp[y][1],dp[y][0]-(s[y]?Y:X));        }    }    if(s[u]) state ^= 1;}int main(){    while(scanf("%d%d%d",&n,&X,&Y)!=EOF)    {        memset(dp,0,sizeof(dp));        memset(head,-1,sizeof(head));        memset(vis,0,sizeof(vis));        int ind = 0;        state = 0;        for (int i = 1; i <= n; i++)        {            scanf("%d%d%d%d",&v[i],&f,&s[i],&p);            if(p) v[i] = -v[i];            edge[ind].t = i;            edge[ind].nxt = head[f];            head[f] = ind++;        }        solve(0);        if(dp[0][0] < 0)            puts("HAHAHAOMG");        else printf("%d\n",dp[0][0]);    }    return 0;}
                                                                                                                                                                         ^
0_0_20614057_22779.cpp: In function 'void solve(int)':
0_0_20614057_22779.cpp:5:197: error: 'vis' was not declared in this scope
     using namespace std;#define maxn 50050int dp[maxn][2];int n,X,Y;bool state;int v[maxn],f,s[maxn],p;struct node{    int t,nxt;}edge[maxn<<1];int head[maxn];bool vis[maxn];void solve(int u){    vis[u] = 1;    if(s[u])state ^= 1;    if(state)v[u] = -v[u];    dp[u][0] = v[u];    dp[u][1] = -v[u];    for (int i = head[u]; i!=-1; i = edge[i].nxt)    {        int y = edge[i].t;        if(!vis[y]){        solve(y);        dp[u][0] += max(dp[y][0],dp[y][1]-(s[y]?Y:X));        dp[u][1] += max(dp[y][1],dp[y][0]-(s[y]?Y:X));        }    }    if(s[u]) state ^= 1;}int main(){    while(scanf("%d%d%d",&n,&X,&Y)!=EOF)    {        memset(dp,0,sizeof(dp));        memset(head,-1,sizeof(head));        memset(vis,0,sizeof(vis));        int ind = 0;        state = 0;        for (int i = 1; i <= n; i++)        {            scanf("%d%d%d%d",&v[i],&f,&s[i],&p);            if(p) v[i] = -v[i];            edge[ind].t = i;            edge[ind].nxt = head[f];            head[f] = ind++;        }        solve(0);        if(dp[0][0] < 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-30 02:45:19, Gzip enabled