One hundred layer Problem Description Now there is a game called the new man down 100th floor. The rules of this game is: 1. At first you are at the 1st floor. And the floor moves up. Of course you can choose which part you will stay in the first…
E.Easy Climb Somewhere in the neighborhood we have a very nice mountain that gives a splendid view over the surrounding area. There is one problem though: climbing this mountain is very difficult, because of rather large height differences. To make m…
最近BZOJ炸了,而我的博客上又更新了一些基本知识,所以这里刷一些裸题,用以丰富知识性博客 POJ2823 滑动的窗口 这是一道经典的单调队题,我记得我刚学的时候就是用这道题作为单调队列的例题,算一道比较基本的题目 先贴题目 Description An array of size n ≤ 106 is given to you. There is a sliding window of size k which is moving from the very left of the arr…
题目描述 (除数博弈论)爱丽丝和鲍勃一起玩游戏,他们轮流行动.爱丽丝先手开局. 最初,黑板上有一个数字 N .在每个玩家的回合,玩家需要执行以下操作: 选出任一 x,满足 0 < x < N 且 N % x == 0 . 用 N - x 替换黑板上的数字 N . 如果玩家无法执行这些操作,就会输掉游戏. 只有在爱丽丝在游戏中取得胜利时才返回 True,否则返回 false.假设两个玩家都以最佳状态参与游戏. 来源:力扣(LeetCode)链接:https://leetcode-cn.com/p…
DP + 单调队列优化 + 平衡树 好题 Description Given an integer sequence { an } of length N, you are to cut the sequence into several parts every one of which is a consecutive subsequence of the original sequence. Every part must satisfy that the sum of the intege…
传送门 单调队列优化dp好题. 有一个很明显的状态设置是f[i][j]表示前i天完剩下了j分股票的最优值. 显然f[i][j]可以从f[i-w-1][k]转移过来. 方程很好推啊. 对于j<kj<kj<k和j>kj>kj>k的情况我们分别对第二维建立单调队列转移. 代码: #include<bits/stdc++.h> #define N 2005 using namespace std; inline int read(){ int ans=0; char…