Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
45650 惠子铭 钓鱼 C++ 无测评数据 0 MS 0 KB 955 2024-04-19 16:14:00

Tests(0/0):


#include<bits/stdc++.h> //万能头,懒人必备QwQ using namespace std; struct node { int s,d; } a[35]; bool operator<(node a,node b) { //重载运算符 return a.s<b.s; } priority_queue <node> q; //优先队列 int t[35],ans,maxn; int main() { int n,h; cin>>n>>h; h*=60; //注意一个是小时,一个是分钟 for (int i=1; i<=n; i++) cin>>a[i].s; for (int i=1; i<=n; i++) cin>>a[i].d; for (int i=1; i<n; i++) cin>>t[i]; for (int i=1; i<=n; i++) { while (!q.empty()) //清空队列 q.pop(); ans=0; //ans值归零 int t1=h; for (int j=1; j<i; j++) //枚举时间 t1-=t[j]*5; for (int j=1; j<=i; j++) //存入队列 q.push(a[j]); while (t1>0&&q.top().s>0) { //枚举所有可能 node v=q.top(); ans+=v.s; q.pop(); v.s-=v.d; q.push(v); t1-=5; } maxn=max(ans,maxn); } cout<<maxn; //输出 return 0; //完美的结束QwQ }