![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
二分/三分/CDQ分治
等我学会后缀自动机
侠影之谜
展开
-
CodeForces 484E Sign on Fence (主席树+二分+排序思维)
#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long long#define lrt int l,int r,int rt#define lson l,m...原创 2020-02-14 22:25:36 · 199 阅读 · 0 评论 -
ZOJ 4062 Plants vs. Zombies (二分+细节)
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=4062#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x...原创 2018-11-07 06:38:48 · 461 阅读 · 0 评论 -
CodeForces - 101B Buses (二分+DP)
题目链接:http://codeforces.com/problemset/problem/101/B#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll lon...原创 2018-11-10 16:23:35 · 261 阅读 · 0 评论 -
Gym 101755K Video Reviews (二分+题意)
题目链接:http://codeforces.com/gym/101755/problem/K#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll unsigne...原创 2018-11-19 19:44:33 · 269 阅读 · 0 评论 -
CodeForces 50D Bombing (二分+概率DP)
题目链接:http://codeforces.com/problemset/problem/50/D#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll unsi...原创 2018-11-20 08:57:16 · 244 阅读 · 0 评论 -
CodeForces 767D Cartons of milk (贪心+二分)
题目链接:http://codeforces.com/problemset/problem/767/D#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll uns...原创 2018-11-18 14:18:51 · 225 阅读 · 0 评论 -
CodeForces 75C Modified GCD (二分+数论)
题目链接:http://codeforces.com/problemset/problem/75/C#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long...原创 2018-11-25 06:20:00 · 198 阅读 · 0 评论 -
Codeforces Round #537 (Div. 2)C Creative Snap (分治)
题目链接:http://codeforces.com/contest/1111/problem/C#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long ...原创 2019-02-04 20:00:48 · 345 阅读 · 0 评论 -
HDU 4417 Super Mario (二分+静态主席树)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4417题目大意:给定一个整数序列,和若干查询,每次查询区间[l,r]中小于等于x的数有多少个。题目分析: 区间第k小的另一种表达方式,假如我们能够log时间求出第k小的数,就可以二分处理这道题。主席树可以搞定静态第k小。#include<bits/stdc++....原创 2019-02-16 21:03:07 · 153 阅读 · 0 评论 -
HDU 4560 我是歌手 (网络流+拆点+二分)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4560题目大意有n个歌手,m种歌曲,每一场演唱会中约束描述如下:每一场演唱会中每个歌手都要上台,每个歌手都有其擅长曲目,一个歌曲全程被不擅长的歌手演唱的次数不超过k,问最多可以半多少场演唱会。题目分析不难发现题目中的答案隐含二分性质,演唱会场数越多其出错的可能性会越大。...原创 2019-03-03 11:32:54 · 377 阅读 · 0 评论 -
HDU 6278 Just $h$-index (静态主席树+二分)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6278题目大意给定一个序列和若干个查询,查询给定区间中最大的h满足至少有h个人其权值不小于h。题目分析其实只要知道区间第k小就可以二分做了,然后区间第k小就用主席树搞一下即可,然后二分答案,假设枚举到mid,观察区间第mid小的数x,如果该位置答案R-mid+1符合计数...原创 2019-03-10 00:41:16 · 229 阅读 · 0 评论 -
Educational Codeforces Round 61 (Rated for Div. 2) D. Stressful Training(贪心+二分+优先队列)
题目链接:http://codeforces.com/contest/1132/problem/D题目大意每个同学电脑有初始电量和电量消耗速度,这堂课有k分钟,其损耗过程有note描述。现在有个输出x,每分钟可以指定一个电脑并充电x,问要维护每位同学电脑电量始终不小于零,其最小的x是多少。题目分析这道题思路倒是蛮容易想的,就是细节比较多!可以看出是二分,并且二分上界是...原创 2019-03-16 19:26:10 · 235 阅读 · 0 评论 -
Codeforces Round #546 (Div. 2) E. Nastya Hasn't Written a Legend(线段树+二分+数学转换)
题目链接:http://codeforces.com/contest/1136/problem/E题目大意给定两个序列,支持两种操作,查询第一个序列的区间和,第二种是修改a数组x位置上的值,增加x,并且如果a[i+1]<a[i]+k[i] 那么a[i+1]=a[i]+k[i]。题目分析[i+1]-S[i]<a[i]-S[i-1],这样我们把a[i]+S[i...原创 2019-03-21 00:52:03 · 129 阅读 · 0 评论 -
ZOJ 4029 Now Loading!!! (前缀和加速+二分)
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=4029#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x...原创 2018-11-01 14:33:28 · 263 阅读 · 0 评论 -
Codeforces 483B Friends and Presents (二分+数论基础知识)
题目链接:http://codeforces.com/problemset/problem/483/B#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll lon...原创 2018-10-31 21:05:00 · 189 阅读 · 0 评论 -
Codeforces 474E Pillars (线段树+DP+二分+离散)
题目链接:http://codeforces.com/problemset/problem/474/E#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define read(x...原创 2018-09-29 23:46:42 · 156 阅读 · 0 评论 -
Codeforces 498 (div 3) C. Three Parts of the Array (二分找下界)
You are given an array d1,d2,…,dnd1,d2,…,dn consisting of nn integer numbers.Your task is to split this array into three parts (some of which may be empty) in such a way that each element of the arr...原创 2018-07-17 07:58:44 · 398 阅读 · 0 评论 -
UVA 1152 和为0的四个值 (二分+中途相遇)
The SUM problem can be formulated as follows: given four lists A,B,C,D of integer values, compute how many quadruplet (a,b,c,d) ∈ A×B×C×D are such that a+b+c+d = 0. In the following, we assume that al...原创 2018-07-06 07:03:34 · 165 阅读 · 0 评论 -
HDU Difference (折半二分思想 + 数据结构的使用)
DifferenceTime Limit: 6000/3000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1432 Accepted Submission(s): 392Problem DescriptionLittle Ruins is playing a number...原创 2018-07-13 23:36:43 · 200 阅读 · 1 评论 -
HDU 5493 Queue (树状数组+二分+构造思维)*
Online Judge Online Exercise Online Teaching Online Contests Exercise Author F.A.QHand In HandOnline AcmersForum | DiscussStatistical Charts Probl...原创 2018-07-29 22:13:34 · 273 阅读 · 3 评论 -
HDU 4217 Data Structure?(二分+树状数组)
Hdu 4217 Data Structure?【二分+树状数组】2017年07月28日 16:06:04阅读数:221 Data Structure?Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 3359 ...原创 2018-07-29 23:59:58 · 185 阅读 · 0 评论 -
HDU 5700 区间交(树状数组+二分+思维)好题。。
区间交Time Limit: 8000/4000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1424 Accepted Submission(s): 543 Problem Description小A有一个含有n个非负整数的数列与m个区间。每个区间可以表示...原创 2018-07-30 22:44:55 · 249 阅读 · 0 评论 -
牛客网多校赛6 ASinging Contest (数据结构应用+模拟)
链接:https://www.nowcoder.com/acm/contest/144/A来源:牛客网 题目描述Jigglypuff is holding a singing contest. There are 2n singers indexed from 1 to 2n participating in the contest.The rule of this contest ...原创 2018-08-04 22:13:00 · 211 阅读 · 0 评论 -
Codeforces 732D Exams (二分+贪心)。。。好题
Vasiliy has an exam period which will continue for n days. He has to pass exams on m subjects. Subjects are numbered from 1 to m.About every day we know exam for which one of m subjects can be passe...原创 2018-08-15 17:28:53 · 264 阅读 · 0 评论 -
HDU 4614 Vases and Flowers (线段树+二分)
Vases and FlowersTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 4695 Accepted Submission(s): 1934 Problem Description Alice is so p...原创 2018-08-15 19:08:14 · 104 阅读 · 0 评论 -
Codeforces round 19D Points(离线处理+Set集合的运用+离散化数据)好题
Pete and Bob invented a new interesting game. Bob takes a sheet of paper and locates a Cartesian coordinate system on it as follows: point (0, 0) is located in the bottom-left corner, Ox axis is direc...原创 2018-08-21 08:42:17 · 159 阅读 · 0 评论 -
BZOJ 2440 完全平方数(莫比乌斯反演+分块处理+二分答案)*
小 X 自幼就很喜欢数。但奇怪的是,他十分讨厌完全平方数。他觉得这些数看起来很令人难受。由此,他也讨厌所有是完全平方数的正整数倍的数。然而这丝毫不影响他对其他数的热爱。这天是小X的生日,小 W 想送一个数给他作为生日礼物。当然他不能送一个小X讨厌的数。他列出了所有小X不讨厌的数,然后选取了第 K个数送给了小X。小X很开心地收下了。然而现在小 W 却记不起送给小X的是哪个数了。你能帮他一...原创 2018-08-21 21:17:07 · 250 阅读 · 0 评论 -
HDU 5101 Select (二分+容斥水过)
SelectTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2331 Accepted Submission(s): 663 Problem DescriptionOne day, Dudu, the most cle...原创 2018-09-02 21:34:47 · 124 阅读 · 0 评论 -
Codeforces Round 491 div2 C Candies (典型下边界二分)
C. Candiestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAfter passing a test, Vasya got himself a box of nn candies. He decided to eat an equal a...原创 2018-06-24 09:39:39 · 339 阅读 · 0 评论