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的更多相关文章

  1. Difference Between Performance Testing, Load Testing and Stress Testing

    http://www.softwaretestinghelp.com/what-is-performance-testing-load-testing-stress-testing/ Differen ...

  2. tsung: an open-source multi-protocol distributed load testing tool

     ROPERTIES::type: KnowledgeBase_Cloud:END: 开源.多协议.分布式的压力测试工具   Item Summary tsung-recorder start 通过p ...

  3. [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 ...

  4. Load Testing Socket.IO Web Applications and Infrastructure

    转自:https://medium.com/better-programming/load-testing-socket-io-web-applications-and-infrastructure- ...

  5. Locust - A modern load testing framework https://locust.io/

    Locust - A modern load testing frameworkhttps://locust.io/

  6. 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 ...

  7. CodeForces 609C Load Balancing

    先算出目标状态,然后拿当前状态与目标状态对比,即可算出答案 #include<cstdio> #include<cmath> #include<cstring> # ...

  8. Difference between Load / Stress / Performance Testing

    Load and stress testing are subsets of performance testing. Performance testing means how best somet ...

  9. Understanding performance, load and stress testing

    What are performance, load and stress testing? Performance testing, load testing and stress testing ...

随机推荐

  1. 让声音更清晰,用PR去掉视频中的噪音

    Premiere V7.0没有支持当前文件类型的输入源的问题 25 我是新手,把DVD影片放到电脑里,显示的是VOB文件,导入类型显示的是所有支持格式,于是我就点击了VOB文件,但是说没有支持当前文件 ...

  2. 第一章SpringBoot入门

    一.简介 SpringBoot来简化Spring应用的开发,约定大于配置,去繁从简,just run就能创建一个独立的产品级别的应用. 背景: j2EE笨重的开发方法,繁多的配置,低下的开发效率,复杂 ...

  3. form中的fieldset标签应用

    不得不说,<fieldset>是个漂亮的家伙. 使用<fieldset>与<legend>可以设计出很好的表单. <style> fieldset:nt ...

  4. 完美解决Linux服务器tomcat开机自启动问题

    经过多次测试终于彻底解决tomcat开机自启动的问题了 PID3=`ps aux | grep /home/server/shichuan/ | grep java | awk '{print $2} ...

  5. UVA12558 Egyptian Fractions (HARD version) (埃及分数,迭代加深搜索)

    UVA12558 Egyptian Fractions (HARD version) 题解 迭代加深搜索,适用于无上界的搜索.每次在一个限定范围中搜索,如果无解再进一步扩大查找范围. 本题中没有分数个 ...

  6. P2455 [SDOI2006]线性方程组(real gauss)

    P2455 [SDOI2006]线性方程组 (upd 2018.11.08: 这才是真正的高斯消元模板) 找到所消未知数(设为x)系数最大的式子,把它提上来 把这个式子的 x 系数约成1 把这个式子用 ...

  7. 根据wsdl文件,soupUI生成webservice客户端代码

    根据wsdl文件,soupUI生成webservice客户端代码 功能介绍: 对于面向WebServie接口开发时,当我们已经获取到WSDL文件后,可以使用soapUI工具生成对应的客户端和服务端代码 ...

  8. 20145105 《Java程序设计》第10周学习总结

    20145105 <Java程序设计>第10周学习总结 教材学习内容总结 JAVA网络编程 一.网络概述 (一)计算机网络概述 网络编程的实质就是两个(或多个)设备(例如计算机)之间的数据 ...

  9. 20145122《Java程序设计》第七周学习总结

    教材学习内容总结 1.在只有Lambda表达式的情况下,参数的类型必须写出来. 2.Lambda表达式本身是中性的,同样的Lambda表达式可用来表示不同目标类型的对象操作. 3.Lambda表达式只 ...

  10. logistic回归和softmax回归

    logistic回归 在 logistic 回归中,我们的训练集由  个已标记的样本构成:.由于 logistic 回归是针对二分类问题的,因此类标记 . 假设函数(hypothesis functi ...