60pts真的求调
查看原帖
60pts真的求调
1394167
li00000000a楼主2024/10/10 17:53

#include<bits/stdc++.h>
using namespace std;
const int N=1e5+10,inf=0x7fff;
int n,m,q,u,v,t;
int a[N],xx;
bool cmp(int x,int y){
	return x>y;
}
queue<int> pq1,pq2,pq3;
void ppopp(int adder){
	if(xx==pq1.front()+adder) pq1.pop();
	else if(xx==pq2.front()+adder) pq2.pop();
	else if(xx==pq3.front()+adder) pq3.pop();
}
int main(){
	scanf("%d%d%d%d%d%d",&n,&m,&q,&u,&v,&t);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	sort(a+1,a+n+1,cmp);
	for(int i=1;i<=n;i++) pq1.push(a[i]);
	int x,y;
	for(int i=1;i<=m;i++){
		if(i==1) xx=pq1.front();
		int ab=-inf,bc=-inf,cd=-inf;
		if(!pq1.empty()) ab=pq1.front();
		if(!pq2.empty()) bc=pq2.front();
		if(!pq3.empty()) cd=pq3.front();
		xx=max(ab+(i-1)*q,max(bc+(i-1)*q,cd+(i-1)*q));
		if(i%t==0) cout<<xx<<' ';
		x=(xx*u)/v;
		y=xx-x;
		pq2.push(max(x,y)-i*q);
		pq3.push(min(x,y)-i*q);
		ppopp((i-1)*q);
	}
	cout<<"\n";
	for(int i=1;i<=n+m;i++){
		int ab=-inf,bc=-inf,cd=-inf;
		if(!pq1.empty()) ab=pq1.front();
		if(!pq2.empty()) bc=pq2.front();
		if(!pq3.empty()) cd=pq3.front();
		xx=max(ab+(m)*q,max(bc+(m)*q,cd+(m)*q));
		if(i%t==0) cout<<xx<<" ";
		ppopp(m*q);
	}
	return 0;
}
2024/10/10 17:53
加载中...