题解:
这个题真的是停麻烦的,一不看题就要忘记干什么。。。
首先这些个蚯蚓的长度是不断增加的(所有蚯蚓都在增加),所以在处理的过程中,先把增加的长度省去,只处理未增加长度。
如果用优先队列复杂度就是O(m*logn) 这样的时间复杂度必然超时。
看了看网上的题解,哦豁然开朗。
用三个队列即可实现
证明如下:
如果a>=b
那么
a * p > = b * p
a - a * > = b - b * p
又因为他们之间同时增加长度,所以可以证明三个队列的单调性。
之后按照题目的要求来进行输入输出即可。

代码:

/*Keep on going Never give up*/
#pragma GCC optimize(3,"Ofast","inline")
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <math.h>
#include <string>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <algorithm>
#include <stdlib.h>
#include <vector>
#include <cctype>
#include<iomanip>
//#define int long long
#define endl '\n'
using namespace std;
const int maxn = 1e5+10;
const int MaxN = 0x3f3f3f3f;
const int MinN = 0xc0c0c00c;
typedef long long ll;
const int inf=0x3f3f3f3f;
const ll mod=1e9+7;
using namespace std;
ll arr[maxn];
queue<ll> a,b,c;

int main(){
    ll n,m,q,u,v,t;
    cin>>n>>m>>q>>u>>v>>t;
    for(int i=0;i<n;i++){
        scanf("%lld",&arr[i]);
    }
    sort(arr,arr+n,greater<ll>());
    for(int i=0;i<n;i++){
        a.push(arr[i]);
    }
    for(int i=1;i<=m;i++){
        ll imax=MinN,flag;
        if(!a.empty())  if(a.front()>imax) imax=a.front(),flag=1;
        if(!b.empty())  if(b.front()>imax) imax=b.front(),flag=2;
        if(!c.empty())  if(c.front()>imax) imax=c.front(),flag=3;

        if(flag==1) a.pop();
        else if(flag==2) b.pop();
        else c.pop();

        imax+=(i-1)*q;
        ll x=imax*u/v;
        ll y=imax-x;

        if(!(i%t)) printf("%lld ",imax);
        b.push(x-i*q);c.push(y-i*q);
    }
    cout<<endl;
    ll cnt=1;
    while(true){
        ll imax=MinN,flag;
        if(a.empty()&&b.empty()&&c.empty()) break;
        if(!a.empty())  if(a.front()>imax) imax=a.front(),flag=1;
        if(!b.empty())  if(b.front()>imax) imax=b.front(),flag=2;
        if(!c.empty())  if(c.front()>imax) imax=c.front(),flag=3;

        if(flag==1) a.pop();
        else if(flag==2) b.pop();
        else c.pop();
        if(cnt%t==0) printf("%lld ",imax+m*q);
        cnt++;
    }
    return 0;
}