90分求助
查看原帖
90分求助
138357
Richard21477楼主2020/10/19 18:07
#include<bits/stdc++.h>
using namespace std;
/*int len[8000000];//top=1 is max
int last=0;
void push(int in){
	last++;
	len[last]=in;
	int ll=last;
	int top;
	while (1){
		top=ll/2;
		if (top==0)
			return;
		if (len[ll]>len[top]){
			swap(len[ll],len[top]);
			ll=top;
		}
		else
			return;
	}
}
int top(){//top,pop
	int ret=len[1];
	swap(len[1],len[last]);
	len[last]=0;
	last--;
	int ll=1;
	int el,er;
	while (1){
		el=ll*2,er==ll*2+1;
		if (el>last)
			break;
		if (el==last){
			if (len[el]>len[ll]){
				swap(len[el],len[ll]);
			}
			break;
		}
		if (len[el]>len[er]){
			if (len[el]>len[ll]){
				swap(len[el],len[ll]);
				ll=el;
			}
			else
				break;
		}
		else{
			if (len[er]>len[ll]){
				swap(len[er],len[ll]);
				ll=er;
			}
			else
				break;
		}
	}
	return ret;
}*/ 
int main(){
	int n,m,q,u,v,t;
	cin>>n>>m>>q>>u>>v>>t;
	double p=u*1.0/v;
	/*int in;
	for (int i=0;i<n;i++){
		scanf("%d",&in);
		push(in);
	}
	int add=0;
	int a,b;
	for (int i=1;i<=m;i++){
		int user=top();
		if (i%t==0){
			printf("%d\n",user+add);
		}
		a=floor((user+add)*p);
		b=user+add-a;
		printf("%d %d\n",a,b);
		add+=q;
		for (int j=1;j<=last;j++)
			printf("%d ",len[j]+add);
		printf("\n");
		push(a-add);
		push(b-add);
	}
	cout<<endl;
	sort(len+1,len+n+m+1,greater<int>());
	for (int i=t;i<=n+m;i+=t){
		printf("%d ",add+len[i]);
	}
	cout<<endl;*/ 
	int x[n];
	for (int i=0;i<n;i++)
		scanf("%d",&x[i]);
	sort(x,x+n,greater<int>());
	queue<int> a,b,c;
	for(int i=0;i<n;i++)
		a.push(x[i]);
	for (int i=1;i<=m;i++){
		int out=-10000000;
		if (!a.empty())
			out=max(out,a.front());
		if (!b.empty())
			out=max(out,b.front());
		if (!c.empty())
			out=max(out,c.front());
		if ((!a.empty())&&out==a.front()){
			a.pop();
		}
		else if ((!b.empty())&&out==b.front()){
			b.pop();
		}
		else{
			c.pop();
		}
		out+=(i-1)*q;
		if (i%t==0){
			printf("%d ",out);
		}
		int bb=floor(out*p);
		int cc=out-bb;
		b.push(bb-i*q);
		c.push(cc-i*q);
	}
	printf("\n");
	int user[n+m+1];
	int cnt=1;
	while (!a.empty()){
		user[cnt]=a.front();
		a.pop();
		cnt++;
	}
	while (!b.empty()){
		user[cnt]=b.front();
		b.pop();
		cnt++;
	}
	while (!c.empty()){
		user[cnt]=c.front();
		c.pop();
		cnt++;
	}
	sort(user+1,user+n+m+1,greater<int>());
	for (int i=t;i<=m+n;i+=t)
		printf("%d ",user[i]+m*q);
	printf("\n");
	return 0;
}

47行用else if判断RE×2,else判断WA*2

2020/10/19 18:07
加载中...