1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
| #include<bits/stdc++.h> #include<iostream> #define ll long long #define ri register int #define back return using namespace std; ll read() { ll x=0,f=1; char ch=getchar(); while(ch<'0'||ch>'9') { if(ch=='-') f=-1; ch=getchar(); } while(ch>='0'&&ch<='9') { x=x*10+ch-'0'; ch=getchar(); } back x*f; } struct node { ll x,last; node(ll x_,ll last_) { x=x_; last=last_; } }; ll n,m,q,u,v,t,a[10000005]; queue<node> q1,q2,q3; bool cmp(ll a,ll b) { back a>b; } int main() { n=read(),m=read(),q=read(),u=read(),v=read(),t=read(); for(ri i=1;i<=n;i++) a[i]=read(); sort(a+1,a+n+1,cmp); for(ri i=1;i<=n;i++) q1.push(node(a[i],1)); for(ri i=1;i<=m;i++) { ll c1,c2,c3; if(q1.empty()) c1=-1e14; else c1=q1.front().x+(i-q1.front().last)*q; if(q2.empty()) c2=-1e14; else c2=q2.front().x+(i-q2.front().last)*q; if(q3.empty()) c3=-1e14; else c3=q3.front().x+(i-q3.front().last)*q; if(c1>=c2&&c1>=c3) { if(i%t==0) cout<<c1<<" "; q1.pop(),q2.push(node(c1-u*c1/v,i+1)),q3.push(node(u*c1/v,i+1)); continue; } if(c2>=c1&&c2>=c3) { if(i%t==0) cout<<c2<<" "; q2.pop(),q2.push(node(c2-u*c2/v,i+1)),q3.push(node(u*c2/v,i+1)); continue; } if(c3>=c2&&c3>=c1) { if(i%t==0) cout<<c3<<" "; q3.pop(),q2.push(node(c3-u*c3/v,i+1)),q3.push(node(u*c3/v,i+1)); continue; } } cout<<"\n"; int cnt=0; while(!q1.empty()||!q2.empty()||!q3.empty()) { ll c1,c2,c3; if(q1.empty()) c1=-1e14; else c1=q1.front().x+(m-q1.front().last+1)*q; if(q2.empty()) c2=-1e14; else c2=q2.front().x+(m-q2.front().last+1)*q; if(q3.empty()) c3=-1e14; else c3=q3.front().x+(m-q3.front().last+1)*q; if(c1>=c2&&c1>=c3) a[++cnt]=c1,q1.pop(); if(c2>=c1&&c2>=c3) a[++cnt]=c2,q2.pop(); if(c3>=c2&&c3>=c1) a[++cnt]=c3,q3.pop(); } for(ri i=t;i<=cnt;i+=t) cout<<a[i]<<" "; back 0; }
|