WA70 pts 求调
查看原帖
WA70 pts 求调
255169
__LePetitPrince__楼主2023/10/20 21:36

Orz

#include <stdio.h>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <iostream>
using namespace std;
const int S = 1e5 + 5;
int n, m, q, t, delta;
int u, v;
int a[S];
queue<int> q1, q2, q3;
priority_queue<int> ans;
bool cmp(int a, int b) {
	return a > b;
}
int main() {
    freopen("P2827.in", "r", stdin);
    freopen("P2827.out", "w", stdout);
    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++) {
		q1.push(a[i]);
	}
	for (int i = 1; i <= m; i++) {
		int h1 = -0x3f3f3f3f, h2 = -0x3f3f3f3f, h3 = -0x3f3f3f3f;
		if (!q1.empty()) {
			h1 = q1.front();
		}
		if (!q2.empty()) {
			h2 = q2.front();
		}
		if (!q3.empty()) {
			h3 = q3.front();
		}
		int x = max(max(h1, h2), h3);
		if (x == h1) {
			q1.pop();
		} else if (x == h2) {
			q2.pop();
		} else if (x == h3) {
			q3.pop();
		}
		x += delta;
		if (i % t == 0) {
            printf("%d ", x);
		}
		int x1 = x * u / v;
		int x2 = x - x1;
		q2.push(x1 - delta - q);
		q3.push(x2 - delta - q);
		delta += q;
	}
	printf("\n");
	while (!q1.empty()) {
		int c = q1.front();
		ans.push(c);
		q1.pop();
	}
	while (!q2.empty()) {
		int c = q2.front();
		ans.push(c);
		q2.pop();
	}
	while (!q3.empty()) {
		int c = q3.front();
		ans.push(c);
		q3.pop();
	}
	for (int i = 1; i <= m + n; i++) {
		if (i % t == 0) {
			printf("%d ", ans.top() + delta);
		}
		ans.pop();
	}
	return 0;
}

2023/10/20 21:36
加载中...