Codeforces 847H - Load Testing
思路:dp。
代码:
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mem(a,b) memset(a,b,sizeof(a) const int N=1e5+;
ll dp[N]={};
ll dp1[N]={};
ll a[N];
ll t[N]={};
ll t1[N]={};
int main()
{
ios::sync_with_stdio(false);
cin.tie();
int n;
cin>>n;
for(int i=;i<=n;i++)cin>>a[i]; t[]=a[];
for(int i=;i<=n;i++)
{
if(a[i]<=t[i-])
{
dp[i]=dp[i-]+t[i-]-a[i]+;
t[i]=t[i-]+;
}
else
{
t[i]=a[i];
dp[i]=dp[i-];
}
} t1[n]=a[n];
for(int i=n-;i>=;i--)
{
if(a[i]<=t1[i+])
{
dp1[i]=dp1[i+]+t1[i+]-a[i]+;
t1[i]=t1[i+]+;
}
else
{
t1[i]=a[i];
dp1[i]=dp1[i+];
}
} ll ans=min(dp1[],dp[n]);
for(int i=;i<=n-;i++)
ans=min(ans,dp1[i]+dp[i]-min(t[i],t1[i])+a[i]); cout<<ans<<endl;
return ;
}
Codeforces 847H - Load Testing的更多相关文章
- Difference Between Performance Testing, Load Testing and Stress Testing
http://www.softwaretestinghelp.com/what-is-performance-testing-load-testing-stress-testing/ Differen ...
- tsung: an open-source multi-protocol distributed load testing tool
ROPERTIES::type: KnowledgeBase_Cloud:END: 开源.多协议.分布式的压力测试工具 Item Summary tsung-recorder start 通过p ...
- [Windows Azure] Load Testing in Windows Azure
The primary goal of a load test is to simulate many users accessing a web application at the same ti ...
- Load Testing Socket.IO Web Applications and Infrastructure
转自:https://medium.com/better-programming/load-testing-socket-io-web-applications-and-infrastructure- ...
- Locust - A modern load testing framework https://locust.io/
Locust - A modern load testing frameworkhttps://locust.io/
- Google Code Jam 2010 Round 1C Problem B. Load Testing
https://code.google.com/codejam/contest/619102/dashboard#s=p1&a=1 Problem Now that you have won ...
- CodeForces 609C Load Balancing
先算出目标状态,然后拿当前状态与目标状态对比,即可算出答案 #include<cstdio> #include<cmath> #include<cstring> # ...
- Difference between Load / Stress / Performance Testing
Load and stress testing are subsets of performance testing. Performance testing means how best somet ...
- Understanding performance, load and stress testing
What are performance, load and stress testing? Performance testing, load testing and stress testing ...
随机推荐
- Lintcode: Lowest Common Ancestor
Given the root and two nodes in a Binary Tree. Find the lowest common ancestor(LCA) of the two nodes ...
- cocos代码研究(7)即时动作子类学习笔记
理论部分 即时动作是会立即被执行的动作.他们没有持续时间动作(ActionInterval)的持续时间属性.继承自 FiniteTimeAction.被 CallFunc, FlipX, FlipY, ...
- 018-DNS解析过程与配置DNS服务
- 网站建设中常用的JS代码段落
1.屏蔽左右键 这个不介绍了. <script language="JavaScript"> document.oncontextmenu=new Function(& ...
- 去n的第一个出现的1
实例十八:去n的第一个出现的1 方法:result=n & (n-1) 与实例十七 思路类似.实例十七是不断取1,本例只去最低位. 解释:n 0000 1111n-1 0000 1110&am ...
- 03:requests与BeautifulSoup结合爬取网页数据应用
1.1 爬虫相关模块命令回顾 1.requests模块 1. pip install requests 2. response = requests.get('http://www.baidu.com ...
- JAVA第十周《网络编程》学习内容总结
JAVA第十周<网络编程>学习内容总结 学习内容总结 1.初听到网络编程四个字可能会觉得很困难,实际上网络编程就是在两个或两个以上的设备(例如计算机)之间传输数据,把数据发送到指定的位置, ...
- Android实践项目汇报总结(下)
微博客户端的设计与实现(下) 第四章 系统详细功能实现 本应用实现了如下主要模块:程序启动模块.登录授权模块.主界面显示模块撰写发表微博模块.用户发布信息模块.软件设置模块. 4.1程序启动模块实现 ...
- 20145326蔡馨熠《网络对抗》shellcode注入&Return-to-libc攻击深入
20145326蔡馨熠<网络对抗>shellcode注入&Return-to-libc攻击深入 准备一段shellcode 首先我们应该知道,到底什么是shellcode.经过上网 ...
- Vue 动态图片加载路径问题和解决方法
最近在做一个树形结构的组件,使用了Vue和element UI中el-tree组件.因为树中每个节点都需要显示一个图标图片,并且需要根据后台传入的数据类型动态地显示,所以图片的路径需要动态地加载.下面 ...