
分治法
文章平均质量分 57
ummmmm
这个作者很懒,什么都没留下…
展开
-
[快速排序/归并排序] 100000个数 HUSTOJ2496
题目描述输入n组测试数据,从小到大排序.输入输出样例输入233 6 548 5 9 7样例输出3 6 55 7 8 9提示(1 <= n <= 100000)#include <iostream>using namespace std;int a[100000];void paixu(in...原创 2018-03-28 18:56:53 · 2115 阅读 · 0 评论 -
[二分] E. Getting Deals Done CFcontest1070E
#include <bits/stdc++.h>#define ll long longusing namespace std;const int mn = 2e5 + 10;int n, m;ll t;int p[mn], xu[mn];bool check(int x){ int lim = xu[x]; // 至少需要xu[x]的能力完成x个,大于xu...原创 2018-12-10 20:56:18 · 262 阅读 · 0 评论 -
[二分+贪心] Kayaking Trip CFgym 101572 K
#include <bits/stdc++.h>using namespace std;const int mn = 3e5 + 10;int sum, cnt;int num[5], s[5], c[mn];struct Node{ int a, b, ts;} node[10];int tnum[5];bool check(int m...原创 2018-12-03 21:18:37 · 329 阅读 · 0 评论 -
[二分] L. Berland University CFcontest/1090/L
#include <bits/stdc++.h>#define ll long longusing namespace std;ll t, n, a, b, k;ll w1, w2;bool check(ll x){ ll p = min(x, a), q = min(x, b); ll sz = p * w1 + q * w2; // 最多上的课 x人总数 ...原创 2018-12-12 17:37:16 · 237 阅读 · 0 评论 -
[后缀数组 + 二分] 求最长不重叠重复子串 POJ - 1743
Musical ThemeTime Limit: 1000MS Memory Limit: 30000K Total Submissions: 35051 Accepted: 11632 DescriptionA musical melody is represented as a sequence of N (1<=N<=20000)n...原创 2018-10-30 11:02:43 · 237 阅读 · 0 评论 -
[二分] 左右差值最小时答案尽可能大 UVALive 7261
二分面积差最小答案暴力往右枚举判断面积差是否变化#include<bits/stdc++.h>#define ll long longusing namespace std;const int mn = 10010;struct node{ int l, r, w, h;} s[mn];int N;ll check(int mid){ ll sl...原创 2018-10-14 20:01:38 · 204 阅读 · 0 评论 -
【KMP+二分枚举】 I - Blue Jeans POJ - 3080
Blue Jeans Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 21193 Accepted: 9399 Description The Genographic Project is a research partnersh...原创 2018-08-30 17:51:07 · 210 阅读 · 0 评论 -
[二分 + 验证] p1m2 HDU6383
p1m2Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 170 Accepted Submission(s): 50 Problem Description度度熊很喜欢数组!!我们称一个整数数组为稳定的,若且唯若...原创 2018-08-12 18:00:23 · 197 阅读 · 0 评论 -
[dinic最大流 + 并查集 + 二分] N - Marriage Match II HDU - 3081
Marriage Match IITime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4899 Accepted Submission(s): 1598 Problem DescriptionPresumably, you...原创 2018-08-04 19:34:30 · 159 阅读 · 0 评论 -
【线段树区间更新+二分】 L - Vases and Flowers HDU - 4614
Vases and FlowersTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 4482 Accepted Submission(s): 1841 Problem Description Alice is so p...原创 2018-07-18 21:52:41 · 150 阅读 · 0 评论 -
【三分/函数先减后增/先增后减】 Strange fuction HDU基础04二分法
Problem DescriptionNow, here is a fuction: F(x) = 6 * x^7+8*x^6+7*x^3+5*x^2-y*x (0 <= x <=100)Can you find the minimum value when x is between 0 and 100.InputThe first line of the input contain...原创 2018-05-11 17:48:53 · 2237 阅读 · 0 评论 -
【最小化最大值】 The Frog's Games HDU基础04二分法
Problem DescriptionThe annual Games in frogs' kingdom started again. The most famous game is the Ironfrog Triathlon. One test in the Ironfrog Triathlon is jumping. This project requires the frog athle...原创 2018-05-11 16:53:30 · 238 阅读 · 0 评论 -
【二分 假定解判断是否可行】 Pie HDU基础04二分法
Problem DescriptionMy birthday is coming up and traditionally I'm serving pie. Not just one pie, no, I have a number N of them, of various tastes and of various sizes. F of my friends are coming to my...原创 2018-05-11 15:34:58 · 173 阅读 · 0 评论 -
【二分查找】 Can you solve this equation? HDU基础04二分法02
Problem DescriptionNow,given the equation 8*x^4 + 7*x^3 + 2*x^2 + 3*x + 6 == Y,can you find its solution between 0 and 100;Now please try your lucky.InputThe first line of the input contains an intege...原创 2018-05-11 14:41:14 · 352 阅读 · 0 评论 -
【二分/set/映射】 Can you find it? HDU基础04分治法
Problem DescriptionGive 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 ...原创 2018-05-10 21:15:09 · 199 阅读 · 0 评论 -
[二分法] 求函数零点 HUSTOJ2795
题目描述有函数:f(x)=x5−15x4+85x3−225x2+274x−121f(x)=x5−15x4+85x3−225x2+274x−121 已知f(1.5)>0 ,f(2.4)<0 且方程f(x)=0 在区间[1.5,2.4] 有且只有一个根,请用二分法求出该根。输入(无)输出该方程在区间[1.5,2.4]中的根。要求四舍五入到小数点后6位。#include <iostre...原创 2018-03-29 19:37:14 · 1247 阅读 · 0 评论 -
[二分法] 一元三次方程求解 HUSTOJ2792
题目描述形如:ax3+bx2+cx+d=0 这样的一个一元三次方程。给出该方程中各项的系数(a,b,c,d均为实数),并约定该方程存在三个不同实根(根的范围在-100至100之间),且根与根之差的绝对值>=1。要求由小到大依次在同一行输出这三个实根(根与根之间留有空格),并精确到小数点后2位。输入一行,包含四个实数a,b,c,d,相邻两个数之间用单个空格隔开。输出一行,包含三个实数,为该方...原创 2018-03-29 19:41:27 · 2145 阅读 · 0 评论 -
[分治法] 循环比赛日程表 HUSTOJ2875
题目描述设有N个选手进行循环比赛,其中N=2M,要求每名选手要与其他N-1名选手都赛一次,每名选手每天比赛一次,循环赛共进行N-1天,要求每天没有选手轮空。输入输入:M。输出输出:表格形式的比赛安排表。一行各数据间用一个空格隔开。样例输入3样例输出1 2 3 4 5 6 7 82 1 4 3 6 5 8 73 4 1 2 7 8 5 64 3 2 1 8 7 6 55 6 7 8 1 2 ...原创 2018-03-29 21:01:11 · 518 阅读 · 0 评论 -
【对偶问题 + 三分】C. Freelancer's Dreams
C. Freelancer's Dreamstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputMikhail the Freelancer dreams of two things: to become a c...原创 2019-02-19 23:48:35 · 224 阅读 · 0 评论