
二分 /三分
sega_handsome
这个作者很懒,什么都没留下…
展开
-
atcoder 1th C
C - Go Home Time limit : 2sec / Memory limit : 256MB Score : 200 points Problem Statement There is a kangaroo at coordinate 0 on an infinite number line that runs from left to right, a原创 2017-03-18 21:56:39 · 566 阅读 · 0 评论 -
Codeforces Round #447 (Div. 2) D 预处理+归并+ 二分
Ralph And His Tour in Binary Countrytime limit per test2.5 seconds memory limit per test512 megabytes inputstandard input outputstandard outputRalph is in the Binary Country. The Binary Country cons转载 2017-11-29 18:05:33 · 173 阅读 · 0 评论 -
Approximating a Constant Range CodeForces - 602B dp or 队列
想了很久想不出怎么用 尺取法做。。 看了别人的dp,好好啊。 http://blog.youkuaiyun.com/gungnir0711/article/details/50280247 也看到有用单调队列+尺取法的 , 也可以用队列做吧。。int main() { int n; scanf("%d",&n); int ans=0; f转载 2017-08-10 11:02:15 · 241 阅读 · 0 评论 -
个人赛3 倒数第二题
CC 还非常喜欢探索世界,他给了你一张 n×nn \times nn×n 的地形图,希望从 (1,1)(1,1)(1,1) 点到达 (n,n)(n,n)(n,n) 点。 CC 可以从当前位置上下左右移动到达相邻格子,但 CC 不喜欢多余的运动,他希望行走路线尽可能平坦。(路线平坦度的定义为路线中海拔最高点与最低点之差) 请你帮 CC 计算出一条最平坦的路线的平坦度。22 1 2 2 14 1 8 7原创 2017-08-31 10:35:37 · 210 阅读 · 0 评论 -
Codeforces Round #409 二分
C. Voltage Keepsake time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard outputYou have n devices that you want to use simultaneously.The i-th原创 2017-08-24 12:31:16 · 277 阅读 · 0 评论 -
二分
最大化最小值此种题目一般是“二分值越小越容易满足条件”,然后求符合条件的最大值。区间长度为1时的写法: 解的范围为 [lb,rb]// 计算区间为[lb, rb] while( rb > lb ) // 区间长度为1时终止循环 { // 防止溢出 int m = lb + (rb - lb + 1) / 2; // 由于是区间长度为1时终止循环,所以要加1 if(转载 2017-08-25 11:22:28 · 226 阅读 · 0 评论 -
hdu6103
多校训练赛6 有多种方法。。。 (1)前缀和+J 参考http://blog.youkuaiyun.com/rain722/article/details/77070926 这个地方的变为unsigned sort 还是有点难去想的, 而且我int n; int m; char s[mxn]; unsigned short dp[mxn][mxn]; bool ok(int mid){ fo转载 2017-08-11 20:28:30 · 398 阅读 · 0 评论 -
Ombrophobic Bovines POJ - 2391 Floyd+ 二分+最大流
Floyd+ 二分+最大流 vj挂了,不知道对不对 #include #include #include #include #include #include #include using namespace std; #define mem(a,b) memset(a,b,sizeof(a)); #define sf scanf #define pf printf #define L转载 2017-04-26 09:31:30 · 300 阅读 · 0 评论 -
CodeFroces 412.C Success Rate
转自:http://blog.youkuaiyun.com/llzhh/article/details/71480809 看别人博客看了挺久,才知道二分的东西是别的。这样二分也是满足单调性的,而且看起来很好写。。。 #include #include #include #include using namespace std; #define sf scanf #define pf printf转载 2017-05-13 14:14:28 · 235 阅读 · 0 评论 -
798B - Mike and strings 各种方式。
自己当时打算用bfs,,结果MLE了。。 想想简直太傻了。。 没有利用好条件,,条件说只会把最前面的放到最后面去。。 这个时候就应该想到之前看过的,,把两个字符串合并在一起啊。。(这个不是就是KMP的吗。。)(看来是思维没有掌握。。) 分析:肯定是把所有串变成其中一个原本就有的串是最优的。。。(我无法证明。。我是弄了一个各种可能。。) 我的代码奇丑务必,放在最后。。转载 2017-04-22 10:36:24 · 542 阅读 · 0 评论 -
SCU4439 二分+枚举进制+思维
自己比赛的时候也想了sort一下, 然后二分,但是还是没有想到枚举进位。。 这个题考虑进位的位置即可, 首先枚举进位是因为达到了10, 100, 1000..., 1e9 我还在考虑如果只按照各位排序的话,能不能推广到按10位,,100位排序, 想写个这样的sort函数,,,但其实用%100,%1000,然后创一个新的数组就可以了。。。 自己还是这些地方不好。。。 #in转载 2017-04-16 16:08:06 · 274 阅读 · 0 评论 -
Codeforces Round #379 (Div. 2) C. Anton and Making Potions 枚举+二分
C. Anton and Making Potions 题目连接:http://codeforces.com/contest/734/problem/C DescriptionAnton is playing a very interesting computer game, but now he is stuck at one of the levels. To pass to the nex转载 2017-12-01 20:59:28 · 167 阅读 · 0 评论