代码:
#include <bits/stdc++.h>
using namespace std;
const int MAX=100;
const int MACHINE=2;
int n;
int M[MAX][MACHINE];
int b[MAX][MACHINE];
int a[MAX][MACHINE];
int y[MAX][MACHINE];
int bestx[MAX];
int bestc;
struct Node
{
int s;
int f1;
int f2;
int sf2;
int bb;
int *x;
bool operator < (const Node &node) const
{
return bb > node.bb;
}
};
priority_queue<Node> pq;
void initNode(Node &node, int n)
{
node.x = new int[n];
int i;
for(i=0; i<n; i++)
node.x[i] = i;
node.s = 0;
node.f1 = 0;
node.f2 = 0;
node.sf2 = 0;
node.bb = 0;
}
void newNode(Node &node, Node E, int Ef1, int Ef2, int Ebb, int n)
{
node.x = new int[n];
int i;
for(i=0; i<n; i++)
node.x[i] = E.x[i];
node.f1 = Ef1;
node.f2 = Ef2;
node.sf2 =