http://arc063.contest.atcoder.jp/tasks/arc063_b

因为每次都是选取最大值,那么用dp[i]表示第i个数结尾能得到最大是多少。

其实就是用a[i]去减去左边最小的那个数字。

然后就是统计有多少个一样的最大值了。。

hack点

T是没用的,我被坑了,以为最多只能T / 2次,那么答案是min(T / 2, cnt_max)

但是不是。就算你T / 2只是1,那么,我也可以走不同的道路来取得max,所以要改变的cnt_max还是要改变。

和T无关。。

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#define IOS ios::sync_with_stdio(false)
using namespace std;
#define inf (0x3f3f3f3f)
typedef long long int LL; #include <iostream>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
const int maxn = 1e6 + ;
int dp[maxn];
void work() {
int n, t;
scanf("%d%d", &n, &t);
if (n == ) while();
int mi = (1LL << ) - ;
int mx = -((1LL << ) - );
for (int i = ; i <= n; ++i) {
int x;
scanf("%d", &x);
dp[i] = max(, x - mi);
mi = min(mi, x);
mx = max(mx, dp[i]);
}
int tim = ;
for (int i = ; i <= n; ++i) {
tim += dp[i] == mx;
}
int ans = tim;
cout << ans << endl;
} int main() {
#ifdef local
freopen("data.txt","r",stdin);
#endif
work();
return ;
}

最新文章

  1. 为什么google bazel构建工具流行不起来
  2. javaScript 查询字符串参数 获取
  3. Linux查找最近修改的文件
  4. (HBase) Error: JAVA_HOME is not set and Java could not be found
  5. Javascript-jQuery【1】-用promise()实现html()回调函数
  6. 19.创建如下三个类:(People类中的三个方法分别输出一些信息,ChinaPeople 和AmericanPeople类重写父类的三个方法)。
  7. N-Queens | &amp; N-Queens II
  8. the application could not be verified
  9. css3 盒模型记
  10. ios中的容器类 ViewController
  11. STM32下载方法
  12. MySQL如何有效地创建基于 INNODB 引擎的表
  13. 给UIImage添加蒙版
  14. keytool 生成 Android SSL 使用的 BKS
  15. 获取CPU序列号
  16. [转载]cookie
  17. Hibernate学习总汇
  18. Java设计模式---桥接Bridge模式
  19. es7你都懂了吗?今天带你了解es7的神器decorator
  20. 423. Reconstruct Original Digits from English(Medium)

热门文章

  1. python多进程执行任务
  2. CNN卷积神经网络_深度残差网络 ResNet——解决神经网络过深反而引起误差增加的根本问题,Highway NetWork 则允许保留一定比例的原始输入 x。(这种思想在inception模型也有,例如卷积是concat并行,而不是串行)这样前面一层的信息,有一定比例可以不经过矩阵乘法和非线性变换,直接传输到下一层,仿佛一条信息高速公路,因此得名Highway Network
  3. codeforces 702B B. Powers of Two(水题)
  4. 详解linux中install命令和cp命令的区别
  5. HihoCoder 1508 : 剑刃风暴(占位)
  6. [AH2017/HNOI2017]抛硬币
  7. Makefile的常用技术总结
  8. MT8735A平台配置MT6630
  9. Tool:Power Designer
  10. bzoj4804