调得人都傻了 评测记录
#include <iostream>
#include <queue>
#include <algorithm>
using namespace std;
double p;
int n,m,q,u,v,t,now;
struct qiuyin{
int l;
bool operator<(qiuyin b)const{
return l<b.l;
}
bool operator>=(qiuyin b)const{
return l>=b.l;
}
bool operator>(qiuyin b)const{
return l>b.l;
}
};
int cmp(qiuyin a, qiuyin b)
{
return a.l>b.l;
}
qiuyin unsort[1000010];
priority_queue<qiuyin> ans;
queue<qiuyin> qy;
queue<qiuyin> qy1;
queue<qiuyin> qy2;
signed main()
{
cin >> n >> m >> q >> u >> v >> t;
p=double(u)/double(v);
for (int i = 0; i < n; i++)
{
qiuyin tmp;
cin >> unsort[i].l;
}
sort(unsort,unsort+n, cmp);
for (int i = 0; i < n; i++)
{
qy.push(unsort[i]);
}
for (int i = 1; i <= m; i++)
{
qiuyin tmp;
if(i>n){
if(qy1.front()>qy2.front())
{
tmp=qy1.front();
qy1.pop();
}
else{
tmp=qy2.front();
qy2.pop();
}
}else{
if(qy.front()>=qy1.front()&&qy.front()>=qy2.front())
{
tmp=qy.front();
qy.pop();
}
else if(qy1.front()>=qy.front()&&qy1.front()>=qy2.front())
{
tmp=qy1.front();
qy1.pop();
}
else
{
tmp=qy2.front();
qy2.pop();
}
}
if(i%t==0)cout << tmp.l+now << " ";
qiuyin tmp1, tmp2;
tmp1.l=double(tmp.l+now)*p;
tmp2.l=tmp.l+now-tmp1.l;
tmp1.l-=q+now;
tmp2.l-=q+now;
//cout << "tmp1: "<< tmp1.l+now<<endl;
//cout << "tmp2: "<< tmp2.l+now<<endl;
qy1.push(tmp1);
qy2.push(tmp2);
now+=q;
}
cout << endl;
while(qy.size())
{
ans.push(qy.front());
qy.pop();
}
while(qy1.size())
{
ans.push(qy1.front());
qy1.pop();
}
while(qy2.size())
{
ans.push(qy2.front());
qy2.pop();
}
for (int i = 1; ans.size(); i++)
{
qiuyin tmp;
tmp=ans.top();
ans.pop();
if(i%t==0)cout << tmp.l+now<< " ";
}
return 0;
}
谢谢大佬!