CodeForces 1420E Battle Lemmings】的更多相关文章

题意 略. \(\texttt{Data Range:}1\leq n\leq 80\) 题解 首先考虑初始状态怎么算答案.很明显直接数满足的不好数,用总的减去不满足的还比较好做.注意到所有不满足的是一段 \(0\),所以就没了. 然后考虑怎么算从一个初始状态转移到一个目标状态的步数.考虑邻项交换,发现肯定是贪心匹配最优. 所以说如果有一个目标序列的话那么就可以算出初始序列到这个序列的步数和这个序列的答案,于是就可以直接 DP 目标序列.(这个时候我们 DP 未被保护的对数的最小值) 设 \(f…
是个补题记录. 1419 除了 F 场上都过了. CF1419A Digit Game 这题好多人 FST 啊-- 考虑如果串长为奇数那么最后操作的肯定是第一个人,串长为偶数的最后操作的肯定是第二个,而且两个人的操作互相独立. 所以如果最后一个操作的是第一个人而且存在一个奇数位置上的数是奇数的话那么第一个人肯定赢,否则第二个人肯定赢. 最后一个操作的是第二个人的话同理. 代码 CF1419B Stairs 很明显只有当 \(n=2^k-1\) 的时候 \(n\) 级的阶梯才会是好的,然后从小到大…
本博客将会收录一些贪心/构造的我认为较有价值的题目,这样可以有效的避免日后碰到 P7115 或者 P7915 这样的题就束手无策进而垫底的情况/dk 某些题目虽然跟贪心关系不大,但是在 CF 上有个 greedy 的 tag,这种题目大概率也会被我收录进来(比方说这篇博客里大概率会收录不少 DP 题,因为 CF 上不少 DP 题都莫名其妙地打上了一个 greedy 的 tag 1. CF1592F1 Alice and Recoloring 1 首先很明显我们不会选择翻转包含 \((1,m),(…
http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n grid. In this game a ships are placed on the grid. Each of the ships consists of bconsecutive cells. No cell can be part of two ships, however, the shi…
D. Sea Battle time limit per test: 1 second memory limit per test :256 megabytes input: standard input output: standard output Galya is playing one-dimensional Sea Battle on a 1 × n grid. In this game a ships are placed on the grid. Each of the ships…
D. One-Dimensional Battle ShipsTime Limit: 2 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/567/problem/D Description Alice and Bob love playing one-dimensional battle ships. They play on the field in the form of a line consisting of n s…
Lemmings 题目连接: http://codeforces.com/contest/163/problem/B Descriptionww.co As you know, lemmings like jumping. For the next spectacular group jump n lemmings gathered near a high rock with k comfortable ledges on it. The first ledge is situated at t…
D. One-Dimensional Battle ShipsTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/567/problem/D Description Alice and Bob love playing one-dimensional battle ships. They play on the field in the form of a line consisting of n …
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Galya is playing one-dimensional Sea Battle on a 1 × n grid. In this game a ships are placed on the grid. Each of the ships consists of b consecu…
D. Sea Battle time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Galya is playing one-dimensional Sea Battle on a 1 × n grid. In this game a ships are placed on the grid. Each of the ships con…