满江红?为何?
  • 板块P1717 钓鱼
  • 楼主方块鼠
  • 当前回复0
  • 已保存回复0
  • 发布时间2024/7/13 20:14
  • 上次更新2024/7/13 21:12:59
查看原帖
满江红?为何?
489725
方块鼠楼主2024/7/13 20:14
#include<iostream>
#include<queue>
using namespace std;
priority_queue<pair<int,int> >heap;
int n;
int f[1000000];
int d[1000000];
int t[1000000];
int ti;
int maxn=-100000;
int main(){
	cin>>n;
	cin>>ti;
	for(int i=1;i<=n;i++){
		cin>>f[i];
	}
	for(int i=1;i<=n;i++){
		cin>>d[i];
	}
	for(int i=1;i<=n-1;i++){
		cin>>t[i];
	}
	ti*=60;
	int walk_time=0;
	int ans=0;
	for(int l=1;l<=n;l++){
		if(!heap.empty()){
			heap.pop();
		}
		for(int i=1;i<=l;i++){
			heap.push(make_pair(f[i],i));
		}
		int T=ti-walk_time;
		ans=0;
		while(T>0&&heap.top().first>0){
			pair<int,int>fish=heap.top();
			heap.pop();
			ans+=fish.first;
			fish.first-=d[fish.second];
			heap.push(fish);
			T-=5;
		}
		walk_time+=t[l];
		if(ans>maxn){
			maxn=ans;
		}
	}
	cout<<maxn<<endl;
}
2024/7/13 20:14
加载中...