一个模特有两种活动。

① 拍照片,挣钱 a。 ②开演唱会,花费b

给定模特这两种工作的时间表。

模特可以选定一个时间举办一个座谈会,那么他拍照片的钱变c。开演唱会会花费d。

要求在模特座谈会之前和后len天(当天凌晨即可生效) 都不能赔钱。 要求你输出最小的座谈会天数。 没有输出-1.。

ll n, a, b, c, d, st, len;
struct node
{
ll tim, tp;
} p[N];
ll calc1(ll x)
{
if(x==-1)
return 0;
return x ? a : -b;
}
ll calc2(ll x)
{
return x ? c : -d;
}
ll tail = 0;
ll mi = inf;
ll res = 0;
ll sum = 0;
int main()
{
sdf(n), sdf(a), sdf(b), sdf(c), sdf(d), sdf(st), sdf(len);
p[0].tim = -1, p[0].tp = -1;
p[n + 1].tim = 1e18;//这里开大点,0x3f3f3f3f不够
For(i, 1, n)
sdf(p[i].tim),
sdf(p[i].tp);
For(i, 0, n)
{
sum += calc1(p[i].tp);
if (sum < -st)
{
cout << -1;
return 0;
}
while (p[tail + 1].tim <= p[i].tim + len)
{
++tail, res += calc2(p[tail].tp);
chkmin(mi, res);
}
if (sum + mi >= -st)
{
cout << p[i].tim + 1;
return 0;
}
mi -= calc2(p[i + 1].tp);
res -= calc2(p[i + 1].tp);
}
return 0;
}

444 D. Ratings and Reality Shows的更多相关文章

  1. Codeforces 887D Ratings and Reality Shows

    Ratings and Reality Shows 参加talk show的时间肯定是在某个t[ i ]的后一秒, 枚举一下就好了. #include<bits/stdc++.h> #de ...

  2. SAE J1850 VPW Implement

    ---恢复内容开始--- OBDII Interface Project When I can ever find enough time away from schoolwork, I try to ...

  3. 每日英语:Why 'The Voice' Is China's No. 1 TV Show

    U.S. fans of the hit talent show 'The Voice' may take for granted that its judges sit with their bac ...

  4. Wide-range regulator delivers 12V, 3A output from 16 to 100V source

    Synchronous buck regulators offer high efficiency and are popular in applications in which available ...

  5. ARVE: Augmented Reality Applications in Vehicle to Edge Networks

    ARVE:车辆到边缘网中的增强现实应用 本文为SIGCOMM 2018 Workshop (Mobile Edge Communications, MECOMM)论文. 笔者翻译了该论文.由于时间仓促 ...

  6. 每日英语:Three Shows That Changed The Way Networks Think About Viewership

    As we continue examining this season’s DVR success stories in The Blacklist and Sleepy Hollow it mak ...

  7. 每日英语:Stalled Project Shows Why China's Economy Is Wobbling

    CAOFEIDIAN, China  $91 billion industrial project here, mired in debt and unfulfilled promise, sugge ...

  8. VR ( Virtual Reality )、AR(Augmented Reality)、MR(Mix Reality)和CR(Cinematic Reality)是什么鬼?

    整个社会对虚拟现实的研究和开发源于上个世纪六十年代,计算机图形学.人机接口技术.图像处理与模式识别.多传感技术.语音处理与音响技术.高性能计算机系统.人工智能等领域在之后半个世纪取得了长足的发展为虚拟 ...

  9. 如何透过HTC Vive拍摄Mixed Reality (混合现实)影片

    https://www.vive.com/cn/forum/1706?extra=page%3D1 也许你是一位开发者,想为自己的HTC Vive游戏制作酷炫的宣传片:或者你是游戏主播,想为观众带来高 ...

随机推荐

  1. 2018-08-03 中文代码示例之Python-如何遍历字典

    此系列之后将参考一些最常用功能的在线教程/示例程序, 进行示例代码的中文化改进. 欢迎推荐有代表性和实用性的教程, 篇幅小更佳. 谢谢. 参考Python - How to loop a dictio ...

  2. Eclipse For JavaSE安装、配置、测试

    Eclipse For JavaSE安装.配置.测试(win7_64bit) 目录 1.概述 2.本文用到的工具 3.安装与配置 4.JavaSE开发测试 5.ADT安装与Android开发测试 6. ...

  3. Git .gitignore文件简介及使用

    Git .gitignore文件简介及使用 By:授客 QQ:1033553122 .gitignore 这个文件的作用就是告诉Git哪些文件不需要添加到版本管理中.实际项目中,很多文件都是不需要版本 ...

  4. How do I install Daydream on my phone?

    Google's philosophy with their newest VR platform is simple. In order to offer the best possible exp ...

  5. NoHttp封装--08 用一个实体类接收所有接口数据

    1.用户信息获取--bean实体类形式返回数据 ①服务器端: 代码: protected void onHandler(HttpServletRequest request, HttpServletR ...

  6. 上了IPD和CMMI,为什么还要搞敏捷?

    文/资深顾问 杨学明 现在国内许多产品创新型企业一旦研发团队上了规模,就会进行IPD体系的变革或CMMI的认证,但现在还有一种更加流程的开发模式,就是敏捷,华为公司早在2009年正式发文在全公司现在流 ...

  7. [20190324]奇怪的GV$FILESPACE_USAGE视图.txt

    [20190324]奇怪的GV$FILESPACE_USAGE视图.txt--//发现GV$FILESPACE_USAGE定义很奇怪,做一个记录.1.环境:SCOTT@book> @ ver1P ...

  8. vs添加到附加进程调试(IIS页面调试)

    有时候单元测试不是很方便,通过页面调试接口会更直观,也跟容易发现问题(尤其是在页面传参的时候),这时vs添加到附加进程的调试方式就显得尤为重要了! 步骤如下: 1.首先是通过IIS建立网站,(前提是要 ...

  9. mssql 一次向表中插入多条数据的方法分享 (转自:http://www.maomao365.com/?p=6058)

    转自:http://www.maomao365.com/?p=6058) <span style="font-size:16px;font-weight:bold;"> ...

  10. NVIDIA显卡笔记本安装ubuntu驱动以及分辨率之详解

    随着对ubuntu的了解,突然想在自己的笔记本上装一个双系统.在网上查了安装方法之后,发现因为nvidia显卡的原因会出现一些问题,结果在我自己装了之后发现问题要比看到的多,再看了无数个帖子之后,最终 ...