队列模拟
详细题解待填坑
#include <cstdio>
#include <algorithm>
#include <queue>
#include <cmath>
using namespace std;
int n,m,q,u,v,t,addl=;
int qx[][];
int to[]={,,,},ta[]={};
int add[]={},inq=;
int mid[];
double p;
int ans[];
bool cmp(int a,int b){
if(a>b)
return true;
return false;
}
int main(){
scanf("%d %d %d %d %d %d",&n,&m,&q,&u,&v,&t);
p=(double)u/(double)v; for(ta[]=;ta[]<=n;ta[]++){
scanf("%d",&mid[ta[]]);
}
--ta[];
sort(mid+,mid++ta[],cmp);
int tp;
for(int i=;i<=m;i++){
if(to[]>ta[]){
if(qx[][to[]]>qx[][to[]])
tp=qx[][to[]++];
else
tp=qx[][to[]++];
}
else if(mid[to[]]>=qx[][to[]]&&mid[to[]]>=qx[][to[]])
tp=mid[to[]],++to[];
else if(qx[][to[]]>=qx[][to[]]&&mid[to[]]<=qx[][to[]])
tp=qx[][to[]],++to[];
else
tp=qx[][to[]],++to[];
tp+=addl;
int a1=floor(p*(double)tp);
int a2=tp-a1;
addl+=q;
a1-=addl;
a2-=addl;
qx[][++ta[]]=a1;
qx[][++ta[]]=a2;
if(i%t==)
printf("%d ",tp);
}
printf("\n");
for(int i=to[];i<=ta[];i++)
ans[++inq]=mid[i];
for(int i=to[];i<=ta[];++i)
ans[++inq]=qx[][i];
for(int i=to[];i<=ta[];++i)
ans[++inq]=qx[][i];
sort(ans+,ans+inq+,cmp);
for(int i=;i<=inq;++i){
if(i%t==)
printf("%d ",ans[i]+addl);
}
return ;
}