
二分
coldfresh
那我们开始吧
展开
-
Subsequence POJ - 3061 (二分法和尺取法两种做法)
A sequence of N positive integers (10 < N < 100 000), each of them less than or equal 10000, and a positive integer S (S < 100 000 000) are given. Write a program to find the minimal length of the subs原创 2017-04-23 14:43:19 · 456 阅读 · 0 评论 -
【CodeChef - CRYPCUR】Crypto Trading(二分套tarjan、拓扑排序)
AMRExchange is the latest cryptocurrency exchange that has become very popular among cryptocurrency traders. On AMRExchange, there are N cryptocurrencies - let us denote the ith currency by Ci. M pair...原创 2018-10-18 14:39:25 · 766 阅读 · 0 评论 -
【51nod 1257】 背包问题 V3 (01分数规划)
基准时间限制:3 秒 空间限制:131072 KB 分值: 80 难度:5级算法题 N个物品的体积为W1,W2……Wn(Wi为整数),与之相对应的价值为P1,P2……Pn(Pi为整数),从中选出K件物品(K <= N),使得单位体积的价值最大。 Input 第1行:包括2个数N, K(1 <= K <= N <= 50000) 第2 - N + 1行:每行2个数W...原创 2018-09-10 14:39:07 · 340 阅读 · 0 评论 -
【51nod 1128】 正整数分组 V2(二分)
基准时间限制:1 秒 空间限制:131072 KB 分值: 80 给出一个长度为N的正整数数组,不改变数组元素的顺序,将这N个数分为K组。各组中元素的和分别为S1,S2….Sk。如何分组,使得S1至Sk中的最大值最小? 例如:1 2 3 4 5 6分为3组,{1 2 3} {4 5} {6},元素和为6, 9, 6,最大值为9。也可以分为{1 2 3 4} {5} {6}。元素和为:10 5...原创 2018-09-06 16:01:32 · 385 阅读 · 0 评论 -
Maximum Mode【Nowcoder多校训练第4场G题】(离散化+二分)
来源:牛客网 题目描述 The mode of an integer sequence is the value that appears most often. Chiaki has n integersa1,a2,...,ana1,a2,...,an a_1,a_2,...,a_n. She woud like to delete exactly m of them such that:...原创 2018-07-28 16:59:06 · 269 阅读 · 0 评论 -
Data Structure? HDU - 4217(树状数组+二分)
Data structure is one of the basic skills for Computer Science students, which is a particular way of storing and organizing data in a computer so that it can be used efficiently. Today let me introdu...原创 2018-07-18 23:54:20 · 232 阅读 · 0 评论 -
Best Cow Fences POJ - 2018(经典二分)
Farmer John’s farm consists of a long row of N (1 <= N <= 100,000)fields. Each field contains a certain number of cows, 1 <= ncows <= 2000. FJ wants to build a fence around a contiguous ...原创 2018-03-19 21:31:18 · 1991 阅读 · 1 评论 -
Telephone Lines POJ - 3662(spfa+二分)
Farmer John wants to set up a telephone line at his farm. Unfortunately, the phone company is uncooperative, so he needs to pay for some of the cables required to connect his farm to the phone system....原创 2018-03-22 13:46:09 · 320 阅读 · 0 评论 -
二分法搜索的应用
二分法是一个应用比较广泛的算法,但是也因此往往被我们忽略,比如这蓝桥杯的倒数第二题,我忽略了线性枚举的超时的可能性,也竟然忘了用二分法(所幸还是进了决赛…)以防万一使用二分会保险一点,今天之所以要将这个,是因为在poj上做到了几道相似的题,所以我觉得有必要总结一下,用三道例题阐述一下:Cable master POJ - 1064 Inhabitants of the Wonderland hav原创 2017-04-23 12:10:26 · 557 阅读 · 0 评论 -
Maximum Subsequence CodeForces - 888E (二分+状压)
You are given an array a consisting of n integers, and additionally an integer m. You have to choose some sequence of indices b1, b2, …, bk (1 ≤ b1 < b2 < … < bk ≤ n) in such a way that the value of i原创 2017-11-12 16:51:12 · 930 阅读 · 0 评论 -
Marriage Match II HDU - 3081 (二分答案+最大流+并查集)
Presumably, you all have known the question of stable marriage match. A girl will choose a boy; it is similar as the game of playing house we used to play when we are kids. What a happy time as so many原创 2017-10-30 18:14:36 · 299 阅读 · 0 评论 -
GCD HDU - 5726 (ST算法+二分)
Give you a sequence of N(N≤100,000)integers : a1,…,an(0#include<cstdio> #include<iostream> #include<queue> #include<cstring> #include<vector> #include<algorithm> #include<cmath> #include<map> #define N原创 2017-09-19 00:54:37 · 721 阅读 · 0 评论 -
Delay Constrained Maximum Capacity Path HDU - 1839(二分+最短路)
Consider an undirected graph with N vertices, numbered from 1 to N, and M edges. The vertex numbered with 1 corresponds to a mine from where some precious minerals are extracted. The vertex numbered wi原创 2017-08-28 14:40:21 · 345 阅读 · 0 评论 -
K-th Number (POJ - 2104 )(平方分割)
You are working for Macrohard company in data structures department. After failing your previous task about key insertion you were asked to write a new data structure that would be able to return quick原创 2017-04-27 11:25:32 · 438 阅读 · 0 评论 -
【POJ - 2018】Best Cow Fences(二分)
Farmer John’s farm consists of a long row of N (1 <= N <= 100,000)fields. Each field contains a certain number of cows, 1 <= ncows <= 2000. FJ wants to build a fence around a contiguous gr...原创 2019-03-05 14:55:09 · 279 阅读 · 0 评论