[noip2016]蚯蚓

原题链接[洛谷]

这个题简直有毒
按照q=0的情况来写
一开始sort超时
后来手动排序
结果
忽略了*u的地方有可能超int
一直卡在50

后面初始化成128[负数最小值]
真的是打死我也想不到(ಥ _ ಥ)
初始化的原因是在有一队取完之后指向位置的数值为0
其他为负数
比较时会出错

哪里有卖蚯蚓吃的
请务必告诉我⁾(ノಠ益ಠ)ノ彡┻━┻

#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<queue>
#include<cstring>
#include<string>
#include<stdio.h>
using namespace std;

long long x,a;
int n,m,q,u,v,t,i,h=1,h1=1,h2=1,p[9999999],r[9999999],l[9999999],k,f[9999999];

int main()
{
    freopen("earthworm.in","r",stdin);
    freopen("earthworm.ans","w",stdout);

    scanf("%d%d%d%d%d%d",&n,&m,&q,&u,&v,&t);

    memset(p,128,sizeof(p));
    memset(l,128,sizeof(l));
    memset(r,128,sizeof(r));

    for(i=1;i<=n;i++)
        scanf("%d",&p[i]);

    sort(p+1,p+n+1,greater<int>());

    for(i=1;i<=m;i++)
    {
        x=max(p[h],max(r[h1],l[h2]));
        if(x==p[h]) h++;
        else if(x==r[h1]) h1++;
             else h2++;
        a=(x+=(i-1)*q)*u/v;
        r[i]=a-i*q;
        l[i]=x-a-i*q;
        if(i%t==0) printf("%lld ",x);
    }

    printf("\n");

    for(i=1;i<=n+m;i++)
    {
        x=max(p[h],max(r[h1],l[h2]));
        if(x==p[h]) h++;
        else if(x==r[h1]) h1++;
             else h2++;
        if(i%t==0) printf("%lld ",x+m*q);
    }

    return 0;
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值