1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
| #include <algorithm> #include <iostream> #include <cstdio> #include <queue> #include <cmath> const int N = 7000000 + 10; using namespace std;
bool cmp(const int &a, const int &b) { return a > b; }
priority_queue<int> ans; int cut1[N], now[N], cut2[N]; int n, m, q, u, v, t; int sum; double p; int h, h1, h2; int t0, t1, t2;
int main() { scanf("%d%d%d%d%d%d", &n, &m, &q, &u, &v, &t); p = (double)u / v; int tmp; for (t0 = 1; t0 <= n; ++t0) scanf("%d", now + t0); --t0; t1 = t2 = 0; h = h1 = h2 = 1; sort(now + 1, now + t0 + 1, cmp); int top; for (int i = 1; i <= m; ++i) { if (h > t0) { if (cut1[h1] > cut2[h2]) top = cut1[h1++]; else top = cut2[h2++]; } else if (now[h] >= cut1[h1] && now[h] >= cut2[h2]) top = now[h], ++h; else if (cut1[h1] >= cut2[h2] && now[h] <= cut1[h1]) top = cut1[h1], ++h1; else top = cut2[h2], ++h2;
top += sum; int a1 = floor(p * (double)top), a2 = top - a1; sum += q; a1 -= sum, a2 -= sum; cut1[++t1] = a1, cut2[++t2] = a2; if (i % t == 0) printf("%d ", top); } putchar('\n'); for (int i = h; i <= t0; ++i) ans.push(now[i]); for (int i = h1; i <= t1; ++i) ans.push(cut1[i]); for (int i = h2; i <= t2; ++i) ans.push(cut2[i]); for (int i = 1; ans.size(); ++i) { if (i % t == 0) printf("%d ", ans.top() + sum); ans.pop(); } return 0; }
|