Dev报错Process exited after 4.03 seconds with return value 3221225725

问题如下:用分支与限界策略求解货物调运问题

某大型集团公司在全国有m (1 < m £ 20) 个产品生产基地(通称产地),用Ai 表示(i = 1, 2, …, m),需要分别将这些物质调运到n (1 < n £ 20) 个集中消费的地区(通称销地),用Bj 表示(j = 1, 2, …, n)。

已知这m 个产地的产量分别为a1, a2, …, am(简写为ai),n 个销地的销量分别为b1, b2, …, bn(简写为bj),从第i 个产地到第j 个销地的单位货运价格为cij,并且总产量和总销量不一定相等。

应当如何制定调运方案,在尽可能地满足销量的前提下,使得总运输费用最小。

在网上找到的代码如下:

#include<iostream>
#include<queue>
#define min(x,y)(x<y?x:y)
using namespace std;
int freight[3][4]={{311,3,100},{1,9,2,8},{7,4,10,5}};
int sales[4]={3,6,5,6};
int production[4]={7,4,9};
int mincost=999;
int key[5][3]={{1,3,2},{2,1,3},{2,3,1},{3,2,1},{3,1,2}};
struct NodeType{
    int r[4];
    int lb;
    int pro[3][4];
    bool operator<(const NodeType &s)const{return lb>s.lb;}
};
void ret(){
    sales[0]=3,sales[1]=6,sales[2]=5,sales[3]=6;
    production[0]=7,production[1]=4,production[2]=9;
}
void bound(NodeType&e){
    int sum=0,j;
    for(int m=0;m<4;m++)
    j=e.r[m];
    int temp,i=0;
    int min=100,max=0,x[3]={0};
    for(int k=0;k<3;k++){
        if(min>freight[k][j]){
            x[0]=k;
            min=freight[k][j];
        }
    }
    for(int k=0;k<3;k++){
        if(max<freight[k][j]){
            x[2]=k;
            max=freight[k][j];
        }
    }
    x[1]=3-x[0]-x[2];
    while(sales[j]>0){
        temp=sales[j];
        e.pro[x[i]][j]=min(sales[j],production[x[i]]);
        sales[j]-=production[x[i]];
        if(sales[j]>0){
            sum=sum+production[x[i]]*freight[x[i]][j];
            production[x[i]]=0;
            i++;
        }
        else{
            sales[j]=0;
            sum=sum+freight[x[i]][j]*temp;
            production[x[i]]-=temp;
        }
        }
        e.lb=sum;
}
void bfs(){
    priority_queue<NodeType>qu;
    NodeType e,e1;
    e.r[4]={0};
    for(int m=0;m<4;m++)
    e.r[m]=m;
    bound(e);
    ret();
    qu.push(e);
    int j=0;
    while(!qu.empty()){
        e=qu.top();
        qu.top();
        if(mincost>e.lb){
            mincost=e.lb;
        }
        e1.r[0]=e.r[0];
        for(int k=1;k<4;k++){
            e1.r[k]=key[j][k-1];
        }
        j++;
        bound(e1);
        ret();
        if(e1.lb<=mincost)
        qu.push(e1);
    }
    cout<<"总运费最小的调运方案为:"<<endl;
    cout<<"\tB1\tB2\tB3\tB4"<<endl;cout<<endl;
    for(int i=0;i<3;i++){
        cout<<"A"<<i+1<<"\t";
        for(int j=0;j<4;j++){
            cout<<e.pro[i][j]<<"\t";
        }
        cout<<endl;cout<<endl;
    }
    cout<<endl;
}
int main(){
int j=0;
int min=100;
bfs();
cout<<"\t运输的最小费用为:";
cout<<mincost<<endl;
return 0;
}



```我用的是Dev-C++ 5.11编译器,经过调试,无错误,但运行时显示"Process exited after 2.721 seconds with return value 3221225477",将代码复制到VS进行调试,发现如下


![img](https://img-mid.csdnimg.cn/release/static/image/mid/ask/609860969936173.png "#left")


求大佬讲解该如何解决 

你好,我是有问必答小助手,非常抱歉,本次您提出的有问必答问题,技术专家团超时未为您做出解答


本次提问扣除的有问必答次数,将会以问答VIP体验卡(1次有问必答机会、商城购买实体图书享受95折优惠)的形式为您补发到账户。


因为有问必答VIP体验卡有效期仅有1天,您在需要使用的时候【私信】联系我,我会为您补发。