45分求条
查看原帖
45分求条
1106246
Loyal_Soldier楼主2025/6/27 11:55

rt

#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 1e5;
queue <int> q1;
queue <int> q2;
queue <int> q3;
int n, m, q, u, v, t;
int a[N];
bool cmp(int a, int b)
{
	return a > b;
}
signed main()
{
	cin >> n >> m >> q >> u >> v >> t;
	for(int i = 1;i <= n;i ++) cin >> a[i];
	sort(a + 1, a + n + 1, cmp);
	for(int i = 1;i <= n;i ++) q1.push(a[i]);
	for(int i = 1;i <= m;i ++)
	{
		int x = 0, y = 0, z = 0;
		if(!q1.empty()) x = q1.front() + (i - 1) * q;
		if(!q2.empty()) y = q2.front() + (i - 1) * q;
		if(!q3.empty()) z = q3.front() + (i - 1) * q;
		int Max = max({x, y, z});
		int Left, Right;
		if(i % t == 0) cout << Max << ' ';
		if(Max == x)
		{
			Left = x * u / v;
			Right = x - Left;
			q1.pop();
		}
		else if(Max == y)
		{
			Left = y * u / v;
			Right = y - Left;
			q2.pop();
		}
		else
		{
			Left = z * u / v;
			Right = z - Left;
			q3.pop();
		}
		q2.push(Left - i * q);
		q3.push(Right - i * q);
	}
	cout << '\n';
	for(int i = 1;i <= n + m;i ++)
	{
		int x = 0, y = 0, z = 0;
		if(!q1.empty()) x = q1.front() + m * q;
		if(!q2.empty()) y = q2.front() + m * q;
		if(!q3.empty()) z = q3.front() + m * q;
		int Max = max({x, y, z});
		if(i % t == 0) cout << Max << ' ';
		if(Max == x) q1.pop();
		else if(Max == y) q2.pop();
		else q3.pop();
	}
	return 0;
}
2025/6/27 11:55
加载中...