
倍增DP
z岁月无声
这个作者很懒,什么都没留下…
展开
-
POJ-3368-Frequent values(倍增DP)
地址:http://poj.org/problem?id=3368思路:倍增DP模板题..Code:#include<iostream>#include<cstdio> #include<cmath>using namespace std;const int MAX_N=5e4+5;int n,Q;int a[MAX_N];in...原创 2019-06-07 13:46:09 · 267 阅读 · 0 评论 -
51Nod-1174-区间中最大的数
1174区间中最大的数基准时间限制:1秒 空间限制:131072KB 分值:0难度:基础题收藏关注给出一个有N个数的序列,编号0 - N - 1。进行Q次查询,查询编号i至j的所有数中,最大的数是多少。例如: 1 7 6 3 1。i = 1, j = 3,对应的数为7 6 3,最大的数为7。(该问题也被称为RMQ问题)Input第1行:1个数...原创 2017-11-14 20:14:32 · 494 阅读 · 0 评论 -
Educational Codeforces Round 66 (Rated for Div. 2)-E. Minimal Segment Cover
地址:https://codeforces.com/contest/1175/problem/E思路:倍增DPdp[i][j]表示以i为起点走 2^j 条线段能够到达的最远位置,那么dp[i][j]=dp[dp[i][j-1]][j-1]对于每次询问,j由大到小判断即可Code:#include<iostream>#include<cstdio&g...原创 2019-06-09 20:18:14 · 166 阅读 · 0 评论