0_0_22552039_30240.cpp:3:10: error: #include expects "FILENAME" or <FILENAME>
#include #include #include #define MAX 777
^
0_0_22552039_30240.cpp:7:8: error: 'MAX' was not declared in this scope
int fa[MAX],val[MAX];
^
0_0_22552039_30240.cpp:7:17: error: 'MAX' was not declared in this scope
int fa[MAX],val[MAX];
^
0_0_22552039_30240.cpp:9:10: error: 'MAX' was not declared in this scope
bool vis[MAX];
^
0_0_22552039_30240.cpp:10:8: error: 'MAX' was not declared in this scope
int dp[MAX][MAX],a[MAX][2];
^
0_0_22552039_30240.cpp:10:13: error: 'MAX' was not declared in this scope
int dp[MAX][MAX],a[MAX][2];
^
0_0_22552039_30240.cpp:10:20: error: 'MAX' was not declared in this scope
int dp[MAX][MAX],a[MAX][2];
^
0_0_22552039_30240.cpp:11:1: error: 'vectorb' does not name a type
vectorb[MAX][2];
^
0_0_22552039_30240.cpp: In function 'void ini()':
0_0_22552039_30240.cpp:21:3: error: 'fa' was not declared in this scope
fa[i]=i;
^
0_0_22552039_30240.cpp:23:3: error: 'val' was not declared in this scope
val[i]=0;
^
0_0_22552039_30240.cpp:25:23: error: expected ';' before '{' token
for(int i=0;i { vis[i]=false; a[i][0]=0; a[i][1]=0; b[i][0].clear(); b[i][1].clear(); } num=1; }
int findr(int x) { if(fa[x]==x)return x; else { int t=fa[x]; fa[x]=findr(fa[x]); if(val[x]) { val[x]=!val[t]; } else { val[x]=val[t]; } return fa[x]; } } int main() { while(scanf("%d%d%d",&p,&p1,&p2)!=EOF) { if(p==0&&p1==0&&p2==0)break; ini(); while(p--) { int u,v; char cmd[7]; scanf("%d%d%s",&u,&v,cmd); int t=(cmd[0]=='n'); int rx=findr(u); int ry=findr(v); if(rx!=ry) { fa[rx]=ry; val[rx]=val[u]^val[v]^t; } } for(int i=1;i<=p1+p2;i++) { if(!vis[i]) { int x=findr(i); for(int j=1;j<=p1+p2;j++) { if(x==findr(j)) { vis[j]=true; b[num][val[j]].push_back(j); a[num][val[j]]++; } } num++; } } for(int i=0;i { for(int j=0;j { dp[i][j]=0; } }
dp[0][0]=1; for(int i=1;i { for(int j=p1;j>=0;j--) { if(j-a[i][0]>=0) { dp[i][j]+=dp[i-1][j-a[i][0]]; } if(j-a[i][1]>=0) { dp[i][j]+=dp[i-1][j-a[i][1]]; } } } if(dp[num-1][p1]!=1) { printf("no\n"); continue; } else { vectorres; res.clear(); for(int i=num-1;i>=0;i--) { if(p1-a[i][0]>=0&&p2-a[i][1]>=0&&dp[i-1][p1-a[i][0]]==1) { for(int j=0;j { res.push_back(b[i][0][j]); } p1-=a[i][0]; p2-=a[i][1]; } else if(p1-a[i][1]>=0&&p2-a[i][0]>=0&&dp[i-1][p1-a[i][1]]==1) { for(int j=0;j { res.push_back(b[i][1][j]); } p1-=a[i][1]; p2-=a[i][0]; } } sort(res.begin(),res.end()); for(int i=0;i { printf("%d\n",res[i]); } printf("end\n"); } } return 0; }
^
0_0_22552039_30240.cpp:25:23: error: expected primary-expression before '{' token
0_0_22552039_30240.cpp:25:23: error: expected ')' before '{' token
0_0_22552039_30240.cpp:25:33: error: 'vis' was not declared in this scope
for(int i=0;i { vis[i]=false; a[i][0]=0; a[i][1]=0; b[i][0].clear(); b[i][1].clear(); } num=1; }
int findr(int x) { if(fa[x]==x)return x; else { int t=fa[x]; fa[x]=findr(fa[x]); if(val[x]) { val[x]=!val[t]; } else { val[x]=val[t]; } return fa[x]; } } int main() { while(scanf("%d%d%d",&p,&p1,&p2)!=EOF) { if(p==0&&p1==0&&p2==0)break; ini(); while(p--) { int u,v; char cmd[7]; scanf("%d%d%s",&u,&v,cmd); int t=(cmd[0]=='n'); int rx=findr(u); int ry=findr(v); if(rx!=ry) { fa[rx]=ry; val[rx]=val[u]^val[v]^t; } } for(int i=1;i<=p1+p2;i++) { if(!vis[i]) { int x=findr(i); for(int j=1;j<=p1+p2;j++) { if(x==findr(j)) { vis[j]=true; b[num][val[j]].push_back(j); a[num][val[j]]++; } } num++; } } for(int i=0;i { for(int j=0;j { dp[i][j]=0; } }
dp[0][0]=1; for(int i=1;i { for(int j=p1;j>=0;j--) { if(j-a[i][0]>=0) { dp[i][j]+=dp[i-1][j-a[i][0]]; } if(j-a[i][1]>=0) { dp[i][j]+=dp[i-1][j-a[i][1]]; } } } if(dp[num-1][p1]!=1) { printf("no\n"); continue; } else { vectorres; res.clear(); for(int i=num-1;i>=0;i--) { if(p1-a[i][0]>=0&&p2-a[i][1]>=0&&dp[i-1][p1-a[i][0]]==1) { for(int j=0;j { res.push_back(b[i][0][j]); } p1-=a[i][0]; p2-=a[i][1]; } else if(p1-a[i][1]>=0&&p2-a[i][0]>=0&&dp[i-1][p1-a[i][1]]==1) { for(int j=0;j { res.push_back(b[i][1][j]); } p1-=a[i][1]; p2-=a[i][0]; } } sort(res.begin(),res.end()); for(int i=0;i { printf("%d\n",res[i]); } printf("end\n"); } } return 0; }
^
0_0_22552039_30240.cpp:25:55: error: 'a' was not declared in this scope
for(int i=0;i { vis[i]=false; a[i][0]=0; a[i][1]=0; b[i][0].clear(); b[i][1].clear(); } num=1; }
int findr(int x) { if(fa[x]==x)return x; else { int t=fa[x]; fa[x]=findr(fa[x]); if(val[x]) { val[x]=!val[t]; } else { val[x]=val[t]; } return fa[x]; } } int main() { while(scanf("%d%d%d",&p,&p1,&p2)!=EOF) { if(p==0&&p1==0&&p2==0)break; ini(); while(p--) { int u,v; char cmd[7]; scanf("%d%d%s",&u,&v,cmd); int t=(cmd[0]=='n'); int rx=findr(u); int ry=findr(v); if(rx!=ry) { fa[rx]=ry; val[rx]=val[u]^val[v]^t; } } for(int i=1;i<=p1+p2;i++) { if(!vis[i]) { int x=findr(i); for(int j=1;j<=p1+p2;j++) { if(x==findr(j)) { vis[j]=true; b[num][val[j]].push_back(j); a[num][val[j]]++; } } num++; } } for(int i=0;i { for(int j=0;j { dp[i][j]=0; } }
dp[0][0]=1; for(int i=1;i { for(int j=p1;j>=0;j--) { if(j-a[i][0]>=0) { dp[i][j]+=dp[i-1][j-a[i][0]]; } if(j-a[i][1]>=0) { dp[i][j]+=dp[i-1][j-a[i][1]]; } } } if(dp[num-1][p1]!=1) { printf("no\n"); continue; } else { vectorres; res.clear(); for(int i=num-1;i>=0;i--) { if(p1-a[i][0]>=0&&p2-a[i][1]>=0&&dp[i-1][p1-a[i][0]]==1) { for(int j=0;j { res.push_back(b[i][0][j]); } p1-=a[i][0]; p2-=a[i][1]; } else if(p1-a[i][1]>=0&&p2-a[i][0]>=0&&dp[i-1][p1-a[i][1]]==1) { for(int j=0;j { res.push_back(b[i][1][j]); } p1-=a[i][1]; p2-=a[i][0]; } } sort(res.begin(),res.end()); for(int i=0;i { printf("%d\n",res[i]); } printf("end\n"); } } return 0; }
|