先按di排序,(从小到大)。然后依次完成合同,若发现第i个合同无法在截止日期前完成,便从之前已经完成的任务中选一个aj最大的合同,付钱来使得这个合同尽快完成。
#include<cstring>
#include<cstdio>
#include<iostream>
#include<queue>
#include<algorithm>
using namespace std;
struct node
{
int q;
int w;
bool operator < (const node& t) const {
return q<t.q;
}
};
struct shsh
{
int q,w,e;
bool operator<(const shsh&kk) const{
......
阅读全文