比赛 |
EYOI常规赛 1st |
评测结果 |
AAAAAAAAAA |
题目名称 |
奶牛晒衣服 |
最终得分 |
100 |
用户昵称 |
ZRQ |
运行时间 |
0.369 s |
代码语言 |
C++ |
内存使用 |
6.06 MiB |
提交时间 |
2021-12-02 21:48:51 |
显示代码纯文本
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<ext/pb_ds/priority_queue.hpp>
using namespace std;
struct node
{
int id,k;
bool operator < (const node &x) const {return x.k>k;}
};
int n,a,b,w[500005],tot=1,ans;
char ch;
inline void read(int &x){x=0;ch=getchar();while(ch<48||ch>57)ch=getchar();while(ch>=48&&ch<=57)x=(x<<3)+(x<<1)+(ch^48),ch=getchar();}
__gnu_pbds::priority_queue<node> q;
int main()
{
freopen("dry.in","r",stdin);
freopen("dry.out","w",stdout);
read(n),read(a),read(b);
for(int i=1;i<=n;++i)
{
read(w[i]);
q.push((node){i,ceil((double)w[i]/a)});
}
q.push((node){0,0});
while(1)
{
node nw=q.top(); q.pop(); ans=nw.k;
if(q.empty()||tot>q.top().k) break;
w[nw.id]-=b;
if(w[nw.id]<=0) nw.k=0;
else nw.k=ceil((double)w[nw.id]/a);
q.push(nw);
++tot;
}
printf("%d\n",ans);
return 0;
}