40分萌新求助 WA一天了
查看原帖
40分萌新求助 WA一天了
557887
acahv楼主2022/7/24 21:50
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <queue>
#include <string>
using namespace std;
int n, m, q, t;
double u, v;
int a[7000005];
int b[7000005];
int c[7000005];
long long ans[7200005];
int top1 = 1;
int top2 = 1, top3 = 1;
int tail1 = 1, tail2 = 1, tail3 = 1;
long long cnt = 0;
bool cmp(int a, int b)
{
   return a > b;
}
bool cmp2(long long a, long long b)
{
   return a > b;
}
inline int read()
{
   int w = 1, data = 0;
   char ch = 0;
   while (ch != '-' && (ch < '0' || ch > '9'))
      ch = getchar();
   if (ch == '-')
      w = -1, ch = getchar();
   while (ch >= '0' && ch <= '9')
      data = data * 10 + ch - '0', ch = getchar();
   return w * data;
}
int main()
{
   cin >> n >> m >> q >> u >> v >> t;

   for (int i = 0; i < 7000005; i++)
      a[i] = b[i] = c[i] = INT32_MIN;

   for (register int i = 0; i < 7200005; i++)
      ans[i] = INT64_MIN;

   for (int i = 1; i <= n; i++)
      a[i] = read();

   sort(a + 1, a + n + 1, cmp);

   tail1 = n + 1;
   long long now;
   long long now1, now2;
   for (int i = 1; i <= m; i++)
   {
      if (a[top1] > b[top2] && a[top1] > c[top3])
         now = a[top1++];

      else if (a[top1] < b[top2] && b[top2] > c[top3])
         now = b[top2++];

      else
         now = c[top3++];

      now += cnt;
      now1 = now / v * u;
      now2 = now - now1;

      cnt += q;
      now1 -= cnt;
      now2 -= cnt;
      b[tail2++] = now2;
      c[tail3++] = now1;

      if (!(i % t))
         printf("%lld ", now);
   }
   cout << endl;

   int qwq = 0;
   for (register int i = top1; i < tail1; i++)
      ans[++qwq] = a[i];
   for (register int i = top2; i < tail2; i++)
      ans[++qwq] = b[i];
   for (register int i = top3; i < tail3; i++)
      ans[++qwq] = c[i];

   sort(ans + 1, ans + n + m + 1, cmp2);
   for (register int i = t; i <= qwq; i += t)
      printf("%lld ", ans[i] + cnt);

   system("pause");
   return 0;
}
2022/7/24 21:50
加载中...