枚举在第i个湖结束钓鱼,那么花在路上的时间确定。贪心策略是每次在鱼剩余最多的地方钓鱼,如果有多个湖,则取编号最小的
出列,更新再入列
#include <iostream>
#include <stdio.h>
#include <memory.h>
#include <memory>
#include <math.h>
#include <algorithm>
#include <stdlib.h>
#include <queue>
using namespace std;
struct node
{
int f,d,id,t;
friend bool operator <(const node &a,const node &b)
{
if(a.f==b.f)
return a.id > b.id;
else
return a.f < b.f;
}
};
node fish[30];
priority_queue <node> q;
int n,T;
int Time[30];
int best[30];
int main()
{
cin >> n;
while(n!=0)
{
cin >> T;
T*=12;
for(int i=0; i<n; i++)
{
cin >> fish[i].f;
fish[i].id =