求调代码
查看原帖
求调代码
921177
liuhaoyan0323楼主2024/12/28 16:54

一开始 8585 pts,听了讲解后改了代码,结果就 4545 pts。

找了题解拍了10分钟也没有不同啊, 求调代码:
rt

#include<bits/stdc++.h>
#define N 100010
#define INF -210000000
using namespace std;
queue<int> q1,q2,q3;
int data[N],add;
inline void read(int &num){
	int x=0,f=1;
	char ch=getchar();
	while(ch>'9'||ch<'0'){
		if(ch=='-')f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9'){
		x=(x<<3)+(x<<1)+ch-'0';
		ch=getchar();
	}
	num=x*f;
}
inline int findmax(){
	int res,x1,x2,x3;
	if(q1.size()){
		x1=q1.front();
	}else{
		x1=INF;
	}
	if(q2.size()){
		x2=q2.front();
	}else{
		x2=INF;
	}
	if(q3.size()){
		x3=q3.front();
	}else{
		x3=INF;
	}
	if(x1>x2&&x1>x3){
		res=x1,q1.pop();
	}else if(x2>x3){
		res=x2,q2.pop();
	}else{
		res=x3,q3.pop();
	}
	return res;
}
inline bool cmp(const int a,const int b){
	return a>b;
}
signed main(){
	int n,m,q,u,v,t;
	read(n);
	read(m);
	read(q);
	read(u);
	read(v);
	read(t);
//	int p=(long double)u/v;
	for(int i=1;i<=n;i++){
		read(data[i]);
	}
	sort(data+1,data+1+n,cmp);
	for(int i=1;i<=n;i++){
		q1.push(data[i]);
	}
	for(int i=1;i<=m;i++){
		int tp=findmax()+add;
		if(i%t==0){
			printf("%lld ",tp);
		}
		add+=q;
//		int fir=(int)(p*tp),sec=(int)tp-fir;
		int fir=(int)((long double)u/v*tp),sec=(int)tp-fir;
		fir-=add;
		sec-=add;
		q2.push(fir);
		q3.push(sec);
	}
	putchar('\n');
	for(int i=1;i<=n+m;i++){
		if(i%t==0){	
			printf("%lld ",findmax()+add);
		}
	}
	return 0;
}
2024/12/28 16:54
加载中...