●BZOJ 3831 [Poi2014]Little Bird】的更多相关文章

3831: [Poi2014]Little Bird Time Limit: 20 Sec Memory Limit: 128 MB Submit: 310 Solved: 186 [Submit][Status][Discuss] Description In the Byteotian Line Forest there are trees in a row. On top of the first one, there is a little bird who would like to…
题链: http://www.lydsy.com/JudgeOnline/problem.php?id=3831 题解: 单调队列优化DP 定义 F[i] 为到达第i课树的疲劳值. 显然最暴力的转移就是枚举i位置前面的k个位置,找到最优的位置跳过来. 每一个询问的复杂度 O(KN),最坏达到O(N²). 考虑优化: 设H为高度的话,对于两个转移来源位置x,y(x<y),如何如何判断那个更优呢? 有如下4种情况: 1).H[y]≥H[x]且F[y]≤F[x],则任何时候选择y都不会比选择x差,所以…
Description In the Byteotian Line Forest there are   trees in a row. On top of the first one, there is a little bird who would like to fly over to the top of the last tree. Being in fact very little, the bird might lack the strength to fly there with…
3831: [Poi2014]Little Bird Time Limit: 20 Sec  Memory Limit: 128 MB Description In the Byteotian Line Forest there are   trees in a row. On top of the first one, there is a little bird who would like to fly over to the top of the last tree. Being in…
3831: [Poi2014]Little Bird Time Limit: 20 Sec  Memory Limit: 128 MBSubmit: 121  Solved: 68[Submit][Status] Description In the Byteotian Line Forest there are   trees in a row. On top of the first one, there is a little bird who would like to fly over…
3831: [Poi2014]Little Bird Time Limit: 20 Sec  Memory Limit: 128 MBSubmit: 505  Solved: 322[Submit][Status][Discuss] Description In the Byteotian Line Forest there are   trees in a row. On top of the first one, there is a little bird who would like t…
题面:[POI2014]PTA-Little Bird 题解: N<=1e6 Q<=25F[i]表示到达第i棵树时需要消耗的最小体力值F[i]=min(F[i],F[j]+(D[j]>=D[i])) (j>=i-K)使用单调队列维护越小的越优,在写单调队列时,让F值最小的数越前因为F[i]-F[j]最多等于1然后如果F值相同,则D越大的越优,因为D越大,后面不用+1的概率越大大概就是这样 代码: #include<cstdio> #include<cstring&…
Description 同OJ3522 数据范围:n<=100000 Solution dp的设计见[刷题]BZOJ 3522 [Poi2014]Hotel 然后发现dp的第二维与深度有关,于是长链剖分就可以优化成 \(O(n)\) 的了 不会写指针,所以写deque #include<bits/stdc++.h> #define ui unsigned int #define ll long long #define db double #define ld long double #…
P3572 [POI2014]PTA-Little Bird 一只鸟从1跳到n.从1开始,跳到比当前矮的不消耗体力,否则消耗一点体力,每次询问有一个步伐限制k,求每次最少耗费多少体力 很简短的题目哼. 首先对于一个点, 他的状态一定是由前 \(k\) 个转移过来的. \(k\) 的长度在每组询问内一定, 想到用单调队列维护 \(dp\) . 不过此时单调队列里的元素有两个关键字: 劳累度和高度, 因为跳到比这个点高的树需要花费恒为一点体力(这个很重要), 所以我们维护单调队列的时候可以以劳累度为…
[BZOJ3831][Poi2014]Little Bird Description In the Byteotian Line Forest there are   trees in a row. On top of the first one, there is a little bird who would like to fly over to the top of the last tree. Being in fact very little, the bird might lack…