随笔分类 - 二分\最大匹配\匈牙利算法
摘要:题目描述 儿童节那天有K位小朋友到小明家做客。小明拿出了珍藏的巧克力招待小朋友们。 小明一共有N块巧克力,其中第i块是Hi x Wi的方格组成的长方形。 为了公平起见,小明需要从这 N 块巧克力中切出K块巧克力分给小朋友们。切出的巧克力需要满足: 1. 形状是正方形,边长是整数 2. 大小相同 例如
阅读全文
摘要:C. Maximum Median 题意: 给定一个数组,可每次可以选择一个数加1,共执行k次,问执行k次操作之后这个数组的中位数最大是多少? 题解:首先对n个数进行排序,我们只对大于中位数a[n/2]的数进行操作,所以这个最大中位数的取值范围是确定的,在区间[ [a[n/2],a[n-1] ]之内
阅读全文
摘要:B. Sport Mafia time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Each evening after the di
阅读全文
摘要:Aggressive cows Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 25944 Accepted: 11982 Description Farmer John has built a new long barn, wi
阅读全文
摘要:Dating with girls(1) Time Limit: 6000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5709 Accepted Submission(s):
阅读全文
摘要:L: Long Long Ago 时间限制: 1 s 内存限制: 128 MB 时间限制: 1 s 内存限制: 128 MB 时间限制: 1 s 内存限制: 128 MB 题目描述 今天SHIELD捕获到一段从敌方基地发出的信息里面包含一串被经过某种算法加密过的的序列L 组织的间谍活动如下几个线索:
阅读全文
摘要:转载自:https://www.jianshu.com/p/0f823fbd4d20 二分查找很好写,却很难写对,出错原因主要集中在判定条件和边界值的选择上,很容易就会导致越界或者死循环的情况。 下面对二分查找及其变形进行总结: 首先,二分查找的序列必须是有序的、有序的、有序的 如果环境允许,可以用
阅读全文
摘要:过山车 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 30799 Accepted Submission(s): 13289 Problem D
阅读全文
摘要:Monthly Expense Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 34725 Accepted: 12983 Description Farmer John is an astounding accounting w
阅读全文
摘要:Cable master 求电缆的最大长度(二分法) Description Inhabitants of the Wonderland have decided to hold a regional programming contest. The Judging Committee has vo
阅读全文