二分
live4m
老菜逼了
展开
-
CodeForces 1288 D.Minimax Problem (二分+状压优化)
D.Minimax Problem You are given n arrays a1, a2, …, an; each array consists of exactly m integers. We denote the y-th element of the x-th array as ax,y. You have to choose two arrays ai and aj (1≤i,j≤...原创 2020-01-16 16:50:41 · 308 阅读 · 1 评论 -
LightOJ 1138 Trailing Zeroes (III) (n的阶乘末尾零的个数+二分)
Problem You task is to find minimal natural number N, so that N! contains exactly Q zeroes on the trail in decimal notation. As you know N! = 12…*N. For example, 5! = 120, 120 contains one zero on the...原创 2019-12-08 16:08:41 · 156 阅读 · 0 评论 -
P1396 营救 (二分 或 kruskal)
题目描述 “咚咚咚……”“查水表!”原来是查水表来了,现在哪里找这么热心上门的查表员啊!小明感动的热泪盈眶,开起了门…… 妈妈下班回家,街坊邻居说小明被一群陌生人强行押上了警车!妈妈丰富的经验告诉她小明被带到了t区,而自己在s区。 该市有m条大道连接n个区,一条大道将两个区相连接,每个大道有一个拥挤度。小明的妈妈虽然很着急,但是不愿意拥挤的人潮冲乱了她优雅的步伐。所以请你帮她规划一条从s至t的路线...原创 2019-11-17 20:44:06 · 246 阅读 · 0 评论 -
CodeForces 1156 C.Match Points (二分)
C.Match Points You are given a set of points x1, x2, …, xn on the number line. Two points i and j can be matched with each other if the following conditions hold: neither i nor j is matched with any o...原创 2019-11-14 18:57:02 · 327 阅读 · 0 评论 -
2019ICPC沈阳网络赛 F.Honk‘s pool(二分)
题意: 给长度为n的数组,和数字k 进行k次操作,每次操作把n个数字中最大的减1,最小的加1 问k次操作之后最大值和最小值的差值是多少 数据范围: n<=5e5,k<=1e9,a(i)<=1e9 思路: 如果k是无限的,那么最大值和最小值肯定接近平均值 但是k不是无限的,因此尽可能接近平均值 设n个数的和为sum a[1]-a[n]从小到大排序 二分最大值: 最大值最小化 左边界...原创 2019-11-12 20:31:43 · 180 阅读 · 0 评论 -
CodeForces1244E.Minimizing Difference (二分)
E.Minimizing Difference You are given a sequence a1,a2,…,an consisting of n integers. You may perform the following operation on this sequence: choose any element and either increase or decrease it by...原创 2019-10-19 23:18:25 · 210 阅读 · 0 评论 -
codeforce1133C. Balanced Team (sort+二分)
C. Balanced Team 题意: 给n个数, 选m个数,这m个数的最大最小差值小于等于5。 输入最大的m值。 思路: 排序+二分,枚举每个数二分求出最大值 #include<iostream> typedef long long ll; const int inf=0x3f3f3f3f; const int inn=0x80808080; using namespace std...原创 2019-05-23 23:11:31 · 198 阅读 · 0 评论 -
poj3685 Matrix (二分套二分)
Matrix Given a N × N matrix A, whose element in the i-th row and j-th column Aij is an number that equals i2 + 100000 × i + j2 - 100000 × j + i × j, you are to find the M-th smallest element in the ma...原创 2019-10-04 19:47:01 · 263 阅读 · 1 评论