0_0_20613597_9475.cpp:13:5: error: 'lower' does not name a type
lower; priority_queue<int,vector<int>,greater<int> >upper; sum=0; for(j=i;j<=n;j++) { if(upper.empty()||a[j]>=upper.top()) { upper.push(a[j]); sum+=a[j]; } else { lower.push(a[j]); sum-=a[j]; } num1=(j-i+1)/2; num2=j-i+1-num1; if(lower.size()>num1) { upper.push(lower.top()); sum+=2*lower.top(); lower.pop(); } else if(upper.size()>num2) { lower.push(upper.top()); sum-=2*upper.top(); upper.pop(); } if(num2>num1) w[i][j]=sum-upper.top(); else w[i][j]=sum; } } for(i=0;i<=m;i++) for(j=0;j<=n;j++) dp[i][j]=INF; dp[0][0]=0; for(i=1;i<=m;i++) { for(j=i;j<=n;j++) { for(k=0;k<j;k++) { dp[i][j]=min(dp[i][j],dp[i-1][k]+w[k+1][j]); } } } printf("%d\n",dp[m][n]); } return 0;}
^
0_0_20613597_9475.cpp:13:23: error: 'priority_queue' does not name a type
lower; priority_queue<int,vector<int>,greater<int> >upper; sum=0; for(j=i;j<=n;j++) { if(upper.empty()||a[j]>=upper.top()) { upper.push(a[j]); sum+=a[j]; } else { lower.push(a[j]); sum-=a[j]; } num1=(j-i+1)/2; num2=j-i+1-num1; if(lower.size()>num1) { upper.push(lower.top()); sum+=2*lower.top(); lower.pop(); } else if(upper.size()>num2) { lower.push(upper.top()); sum-=2*upper.top(); upper.pop(); } if(num2>num1) w[i][j]=sum-upper.top(); else w[i][j]=sum; } } for(i=0;i<=m;i++) for(j=0;j<=n;j++) dp[i][j]=INF; dp[0][0]=0; for(i=1;i<=m;i++) { for(j=i;j<=n;j++) { for(k=0;k<j;k++) { dp[i][j]=min(dp[i][j],dp[i-1][k]+w[k+1][j]); } } } printf("%d\n",dp[m][n]); } return 0;}
^
0_0_20613597_9475.cpp:13:86: error: 'sum' does not name a type
lower; priority_queue<int,vector<int>,greater<int> >upper; sum=0; for(j=i;j<=n;j++) { if(upper.empty()||a[j]>=upper.top()) { upper.push(a[j]); sum+=a[j]; } else { lower.push(a[j]); sum-=a[j]; } num1=(j-i+1)/2; num2=j-i+1-num1; if(lower.size()>num1) { upper.push(lower.top()); sum+=2*lower.top(); lower.pop(); } else if(upper.size()>num2) { lower.push(upper.top()); sum-=2*upper.top(); upper.pop(); } if(num2>num1) w[i][j]=sum-upper.top(); else w[i][j]=sum; } } for(i=0;i<=m;i++) for(j=0;j<=n;j++) dp[i][j]=INF; dp[0][0]=0; for(i=1;i<=m;i++) { for(j=i;j<=n;j++) { for(k=0;k<j;k++) { dp[i][j]=min(dp[i][j],dp[i-1][k]+w[k+1][j]); } } } printf("%d\n",dp[m][n]); } return 0;}
^
0_0_20613597_9475.cpp:13:104: error: expected unqualified-id before 'for'
lower; priority_queue<int,vector<int>,greater<int> >upper; sum=0; for(j=i;j<=n;j++) { if(upper.empty()||a[j]>=upper.top()) { upper.push(a[j]); sum+=a[j]; } else { lower.push(a[j]); sum-=a[j]; } num1=(j-i+1)/2; num2=j-i+1-num1; if(lower.size()>num1) { upper.push(lower.top()); sum+=2*lower.top(); lower.pop(); } else if(upper.size()>num2) { lower.push(upper.top()); sum-=2*upper.top(); upper.pop(); } if(num2>num1) w[i][j]=sum-upper.top(); else w[i][j]=sum; } } for(i=0;i<=m;i++) for(j=0;j<=n;j++) dp[i][j]=INF; dp[0][0]=0; for(i=1;i<=m;i++) { for(j=i;j<=n;j++) { for(k=0;k<j;k++) { dp[i][j]=min(dp[i][j],dp[i-1][k]+w[k+1][j]); } } } printf("%d\n",dp[m][n]); } return 0;}
^
0_0_20613597_9475.cpp:13:112: error: 'j' does not name a type
lower; priority_queue<int,vector<int>,greater<int> >upper; sum=0; for(j=i;j<=n;j++) { if(upper.empty()||a[j]>=upper.top()) { upper.push(a[j]); sum+=a[j]; } else { lower.push(a[j]); sum-=a[j]; } num1=(j-i+1)/2; num2=j-i+1-num1; if(lower.size()>num1) { upper.push(lower.top()); sum+=2*lower.top(); lower.pop(); } else if(upper.size()>num2) { lower.push(upper.top()); sum-=2*upper.top(); upper.pop(); } if(num2>num1) w[i][j]=sum-upper.top(); else w[i][j]=sum; } } for(i=0;i<=m;i++) for(j=0;j<=n;j++) dp[i][j]=INF; dp[0][0]=0; for(i=1;i<=m;i++) { for(j=i;j<=n;j++) { for(k=0;k<j;k++) { dp[i][j]=min(dp[i][j],dp[i-1][k]+w[k+1][j]); } } } printf("%d\n",dp[m][n]); } return 0;}
^
0_0_20613597_9475.cpp:13:117: error: 'j' does not name a type
lower; priority_queue<int,vector<int>,greater<int> >upper; sum=0; for(j=i;j<=n;j++) { if(upper.empty()||a[j]>=upper.top()) { upper.push(a[j]); sum+=a[j]; } else { lower.push(a[j]); sum-=a[j]; } num1=(j-i+1)/2; num2=j-i+1-num1; if(lower.size()>num1) { upper.push(lower.top()); sum+=2*lower.top(); lower.pop(); } else if(upper.size()>num2) { lower.push(upper.top()); sum-=2*upper.top(); upper.pop(); } if(num2>num1) w[i][j]=sum-upper.top(); else w[i][j]=sum; } } for(i=0;i<=m;i++) for(j=0;j<=n;j++) dp[i][j]=INF; dp[0][0]=0; for(i=1;i<=m;i++) { for(j=i;j<=n;j++) { for(k=0;k<j;k++) { dp[i][j]=min(dp[i][j],dp[i-1][k]+w[k+1][j]); } } } printf("%d\n",dp[m][n]); } return 0;}
^
0_0_20613597_9475.cpp:13:943: error: expected declaration before '}' token
lower; priority_queue<int,vector<int>,greater<int> >upper; sum=0; for(j=i;j<=n;j++) { if(upper.empty()||a[j]>=upper.top()) { upper.push(a[j]); sum+=a[j]; } else { lower.push(a[j]); sum-=a[j]; } num1=(j-i+1)/2; num2=j-i+1-num1; if(lower.size()>num1) { upper.push(lower.top()); sum+=2*lower.top(); lower.pop(); } else if(upper.size()>num2) { lower.push(upper.top()); sum-=2*upper.top(); upper.pop(); } if(num2>num1) w[i][j]=sum-upper.top(); else w[i][j]=sum; } } for(i=0;i<=m;i++) for(j=0;j<=n;j++) dp[i][j]=INF; dp[0][0]=0; for(i=1;i<=m;i++) { for(j=i;j<=n;j++) { for(k=0;k<j;k++) { dp[i][j]=min(dp[i][j],dp[i-1][k]+w[k+1][j]); } } } printf("%d\n",dp[m][n]); } return 0;}
|