85分
1 #include<iostream> 2 #include<cstdio> 3 #include<queue> 4 #include<cmath> 5 using namespace std; 6 typedef long long ll; 7 typedef pair<ll,int>pii; 8 const int maxn=1e5+7; 9 const int maxm=7*1e6+7; 10 priority_queue<int>q; 11 int n,m,qq,u,v,t; 12 int pup_top,lat_top; 13 ll a[maxn],pup[maxm],lat[maxn]; 14 double p; 15 int main(){ 16 cin>>n>>m>>qq>>u>>v>>t; 17 p=(double)u/v; 18 for(int i=1;i<=n;i++){ 19 cin>>a[i]; 20 q.push(a[i]); 21 } 22 for(int i=1;i<=m;i++){ 23 int k=q.top();q.pop(); 24 k+=(i-1)*qq;pup[++pup_top]=k; 25 q.push(floor(p*k)-qq*i);q.push((k-floor(p*k)-qq*i)); 26 } 27 for(int i=t;i<=m;i+=t) cout<<pup[i]<<" "; 28 cout<<endl; 29 while(!q.empty()){ 30 int k=q.top();q.pop(); 31 k+=qq*m; 32 lat[++lat_top]=k; 33 } 34 for(int i=t;i<=n+m;i+=t) cout<<lat[i]<<" "; 35 cout<<endl; 36 return 0; 37 }
三个具有单调性的序列
没调出来......
1 #include<iostream> 2 #include<cstdio> 3 #include<cmath> 4 #include<algorithm> 5 #include<queue> 6 #include<cstring> 7 using namespace std; 8 typedef long long ll; 9 const int maxn=1e5+7; 10 const int maxm=7*1e6+7; 11 ll n,m,qq,u,v,tt,h=1,t,h1=1,t1,h2=1,t2,k; 12 ll pup_top,lat_top; 13 ll a[maxn],pup[maxm],lat[maxn],q[maxn],q1[maxn],q2[maxn]; 14 double p; 15 bool cmp(ll x,ll y){return x>y;} 16 int main(){ 17 freopen("a.in","r",stdin); 18 freopen("a.out","w",stdout); 19 cin>>n>>m>>qq>>u>>v>>tt; 20 p=(double)u/v; 21 for(int i=1;i<=n;i++){ 22 cin>>a[i];q[++t]=a[i]; 23 } 24 sort(q+1,q+n+1,cmp); 25 for(int i=1;i<=m;i++){ 26 int ans=-0x3f3f3f3f,node=-1; 27 if(h<=t&&h1<=t1){ 28 if(q[h]>q1[h1]){ans=q[h];node=0;} 29 else{ans=q1[h1];node=1;} 30 } 31 else if(h>t&&h1<=t1){ans=q1[h1];node=1;} 32 else if(h1>t1&&h<=t){ans=q[h];node=0;} 33 else if(h>t&&h1>t1){ans=-0x3f3f3f3f;} 34 if(q2[h2]>ans&&h2<=t2) node=2; 35 if(node==0){ 36 k=q[h];h++; 37 } 38 if(node==1){ 39 k=q1[h1];h1++; 40 } 41 if(node==2){ 42 k=q2[h2];h2++; 43 } 44 k+=(i-1)*qq;if(i%tt==0) cout<<k<<" "; 45 q1[++t1]=floor(p*(double)k)-qq*i; q2[++t2]=k-floor(p*(double)k)-qq*i; 46 } 47 cout<<endl; 48 for(int i=h;i<=t;i++) lat[++lat_top]=q[i]+qq*m; 49 for(int i=h1;i<=t1;i++) lat[++lat_top]=q1[i]+qq*m; 50 for(int i=h2;i<=t2;i++) lat[++lat_top]=q2[i]+qq*m; 51 sort(lat+1,lat+1+lat_top,cmp); 52 for(int i=tt;i<=n+m;i+=tt) cout<<lat[i]<<" "; 53 cout<<endl; 54 fclose(stdin); 55 fclose(stdout); 56 return 0; 57 }