求助为什么这样输出会有奇奇怪怪的数字
查看原帖
求助为什么这样输出会有奇奇怪怪的数字
235901
Always_Remember_It楼主2024/7/5 21:50
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N=1e5+10;
int a[N];
vector<int> g;
void update(int x){
	//if(x>=g[g.size()]||(!g.size())) g.push_back(x);
	g.insert(lower_bound(g.begin(),g.end(),x),x);
	return;
}
signed main(){
	int n,m,q,u,v,t;cin>>n>>m>>q>>u>>v>>t;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		if(i==1) g.push_back(a[1]);
		else g.insert(lower_bound(g.begin(),g.end(),a[i]),a[i]);
	}
	for(int i=1;i<=m;i++){
		int now=g[n+i-1]+(i-1)*q;
		//if(i%t==0) cout<<now<<" ";
		g.pop_back();
		int l1=now*u/v;
		int l2=now-l1;
		//cout<<l1<<" "<<l2<<endl;
		update(l1-i*q);
		update(l2-i*q);
		for(int j=0;j<g.size();j++){
			cout<<g[j]<<" ";
		}
		cout<<endl;
		//g.insert(lower_bound(g.begin(),g.end(),l1-i*q),l1-i*q);
		//g.insert(lower_bound(g.begin(),g.end(),l2-i*q),l2-i*q);
	}
	//cout<<endl;
	//for(int i=n+m-1;i>=0;i--){
	//	cout<<g[i]+(n+m)*q<<" ";
	//}
	return 0;
}
2024/7/5 21:50
加载中...