每日一题- P2827

可爱的单调性啊,不会

#include<bits/stdc++.h>
using namespace std;
#define int long long
int n,m,q,u,v,t,a[100005];
queue<int> que[3];
signed main(){
	scanf("%lld%lld%lld%lld%lld%lld",&n,&m,&q,&u,&v,&t);
	for(int i=1;i<=n;i++)scanf("%lld",&a[i]);
	sort(a+1,a+1+n);
	for(int i=n;i>=1;i--)que[0].push(a[i]);
	for(int i=1;i<=m;i++){
		int x=-1e18,y;
		for(int j=0;j<3;j++)
			if(!que[j].empty() && x<que[j].front())
				x=que[j].front(),y=j;
		x+=q*(i-1);que[y].pop();
		int xa=x*u/v,xb=x-xa;
		xa-=q*i;xb-=q*i;
		que[1].push(xa);
		que[2].push(xb);
		if(i%t==0)printf("%lld ",x);
	}
	puts("");
	for(int i=1;i<=n+m;i++){
		int x=-1e18,y;
		for(int j=0;j<3;j++)
			if(!que[j].empty() && x<que[j].front())
				x=que[j].front(),y=j;
		que[y].pop();
		if(i%t==0)printf("%lld ",x+m*q);
	}
	puts("");
	return 0;
}
posted @ 2024-07-27 15:47  Kent530  阅读(1)  评论(0编辑  收藏  举报