![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
二分查找
文章平均质量分 53
超越大哥哥
这个作者很懒,什么都没留下…
展开
-
上色的纱雾(二分搜索)
上色的纱雾Time Limit: 1000 ms / Memory Limit: 65536 kbDescription 纱雾画画功力首屈一指,现在她准备上色了,这时候她在想,怎样上色的时间最短呢? 在这里我们把问题简化,平面图抽象成坐标轴,需要上色的地方抽象成 n 个点,纱雾有 m 支画笔。开始的时候纱雾可以选择让画笔落在坐标轴任意一点上,之后每次移动画笔一...原创 2018-08-04 12:43:48 · 261 阅读 · 0 评论 -
二分查找的变异写法
最近接触的二分查找变的多了起来先推荐一篇很不错的博客叭https://blog.csdn.net/zxzxzx0119/article/details/82670761首先二分查找普通的写法就是int bina(int *a,int key){ int l = 1; int r = n; int coun = 0; while(l<=r...原创 2019-04-07 19:25:35 · 166 阅读 · 0 评论 -
Carries-省赛训练一-暴力+二分
这个题就是暴力+二分公式是如果a%k^10+b%k^10>=k^10那么就溢出了所以对k枚举9次每次从前往后对每个元素进行二分查找,找到第一个符合公式的数,后面的数都符合溢出#include<iostream>#include<cstdio>#include<algorithm>using namespace std;typede...原创 2019-04-07 21:41:17 · 100 阅读 · 0 评论 -
luoguP1182(二分搜索)
好久没写二分搜索题了这个题目大体意思就是给你一串数字让你选出连续的m段数字使得和最大的数字段的和最小就是二分答案//// Created by xingchaoyue on 2019/5/15.//#include<iostream>#include<cstdio>using namespace std;int n,m;const int ...原创 2019-05-15 15:10:19 · 130 阅读 · 0 评论 -
luoguP1577(二分答案)
二分答案写了一下就出来了...但是在二分那里卡住了先po上代码 日后再解惑//// Created by xingchaoyue on 2019/5/15.//#include<iostream>#include<cstdio>using namespace std;int n,m;int a[10000+100];int ri = 0;i...原创 2019-05-15 16:08:56 · 197 阅读 · 0 评论 -
2019CCPC网络赛K-th occurrence(后缀数组+ST+二分+主席树)
比赛的时候思路完全正确 但是不知道为啥卡在了二分上当时没整明白这个题确实有点东西....lcp函数当两个参数相同时是查找不到的 这个需要注意其余的就是利用rank找到对应的排名然后两个二分查询1..排名..n的符合条件的区间然后利用主席树维护SA数组区间第k大即可就是代码有点长#include<iostream>#include<cstdio&...原创 2019-09-10 17:42:45 · 272 阅读 · 0 评论 -
poj3261(后缀数组+二分+kuangbin模版注意问题)
#include<iostream>#include<cstdio>#include<string.h>using namespace std;const int maxn = 2000000+1000;int t1[maxn],t2[maxn],c[maxn*10];bool cmp(int *r, int a, int b, int l)...原创 2019-09-19 17:02:10 · 134 阅读 · 0 评论