
【二分/三分/分治】
文章平均质量分 79
Kuguotao
这个作者很懒,什么都没留下…
展开
-
K - Can you find it? HDU - 2141(二分法)
Give you three sequences of numbers A, B, C, then we give you a number X. Now you need to calculate if you can find the three numbers Ai, Bj, Ck, which satisfy the formula Ai+Bj+Ck = X. InputThere原创 2018-04-06 10:03:50 · 256 阅读 · 0 评论 -
NYOJ-1599-分班(class)
题目描述: jsb 是 XX 市第一中学的校长。一轮模拟考试结束后,jsb 想让所有学生重新分班。 XX 市第一中学共有 n 位学生,其中第 i 个学生的该次模拟考试的成绩为 bi。jsb 打算将所 有学生分配到 m 个班级里,第 i 个班级的人数为 ai,即需要将恰好 ai 个人分配到第 i 个班级 内。 然而,如果班级里的学霸和班级内的其他同学水平差距过大,会使学霸产生自...原创 2019-03-13 19:43:14 · 536 阅读 · 0 评论 -
O - Pie POJ - 3122(二分)
题意:n个pie,m个朋友,自己也要吃,所以是m+1个人分pie,要保证每个人的pie一样大。#include <iostream>#include<stdio.h>#include<queue>#include<map>#include<algorithm>#include<string.h>using n...原创 2019-03-29 17:18:42 · 165 阅读 · 0 评论 -
L - Interviewe HDU - 3486(RMQ+二分)
YaoYao has a company and he wants to employ m people recently. Since his company is so famous, there are n people coming for the interview. However, YaoYao is so busy that he has no time to interview ...原创 2019-04-18 11:31:08 · 229 阅读 · 0 评论 -
51nod 1267 4个数和为0
给出N个整数,你来判断一下是否能够选出4个数,他们的和为0,可以则输出"Yes",否则输出"No"。收起输入第1行,1个数N,N为数组的长度(4 <= N <= 1000)第2 - N + 1行:A[i](-10^9 <= A[i] <= 10^9)输出如果可以选出4个数,使得他们的和为0,则输出"Yes",否则输出"No"。输入样例5...原创 2019-04-19 16:26:56 · 173 阅读 · 0 评论 -
区间分治—19牛客多校 3 G Removing Stones
19牛客多校 3 G题意:给你一个数组,求满足一个区间(l,r)的最大值大于等于其区间和的1/2(l!=r)思路:区间分治 把最大值作为分界线。#include <cstdio>#include <queue>#include <cstring>#include <iostream>#include <algorithm&...原创 2019-08-22 14:30:23 · 249 阅读 · 0 评论 -
D. Restore Permutation(树状数组+二分)
D. Restore Permutation题意:第一行给你一个数n,第二行输入n个数,第 i 个数表示其前面的所有比其小的数的和,让你还原这个原数列(该原数列数值1->n)。思路:从后往前解决。利用树状数组求出tree[i]。利用二分查找a[i],确定位置,存入s[i],最后输出。代码:#include <cstdio>#include <queue&...原创 2019-09-02 21:33:56 · 235 阅读 · 0 评论