题意:从C有奶牛中选N头,给出它们的分数scores和资助aid,要是这N头牛的总资助不超过F,同时它们中分数的中位数最大。求这个最大的中位数。
思路:按照分数排序,枚举每头牛作为中位数,计算牛i前面N/2头牛的最小资助和后面N/2牛的最小资助(用到优先队列)。最后从后往前找第一个满足l[i]+r[i]+cow[i].second<=F的即为答案。...
分类:
其他好文 时间:
2015-03-21 17:13:09
阅读次数:
247
poj3267——线性dpThe Cow LexiconTime Limit:2000MSMemory Limit:65536KTotal Submissions:8458Accepted:3993DescriptionFew know that the cows have their own di...
分类:
其他好文 时间:
2015-03-19 23:41:31
阅读次数:
238
D - Fliptile
Time Limit:2000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u
Submit Status Practice POJ 3279
Description
Farmer John knows that an intellectually satisfied cow is a happy ...
分类:
其他好文 时间:
2015-03-19 22:04:33
阅读次数:
141
Catch That Cow
Time Limit: 2000MS
Memory Limit: 65536K
Total Submissions: 52335
Accepted: 16416
Description
Farmer John has been informed of the location of a fugit...
分类:
其他好文 时间:
2015-03-18 23:25:55
阅读次数:
180
http://poj.org/problem?id=3617 #include
#include
#include
#include
#include
using namespace std; const int MAX_N=2000;
char S[MAX_N+1];
int N;
int mai...
分类:
其他好文 时间:
2015-03-17 14:10:16
阅读次数:
125
DescriptionFarmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a pointN(0 ≤N≤ 100,000) on...
分类:
其他好文 时间:
2015-03-15 18:25:42
阅读次数:
126
Description One cow from each of N farms (1 ≤ N ≤ 1000) conveniently numbered 1..N is going to attend the big cow party to be held at farm #X (1 ≤ ...
分类:
其他好文 时间:
2015-03-15 00:32:06
阅读次数:
159
http://poj.org/problem?id=3278从n出发,向两边转移,为了不使数字无限制扩大,限制在2*k以内,注意不能限制在k以内,否则就缺少不断使用-1得到的一些结果#include #include #include #include using namespace std;con...
分类:
其他好文 时间:
2015-03-14 15:02:52
阅读次数:
164
题意:给你a[2] - a[n], 一个初始x = 1,初始y = 0 ,执行下面步骤1) x +=a[x] ,y += a[x]2) x -= a[x] ,y += a[x]3)重复1-2步骤。只要中间x n 就跳出。输出y的值问你a[1] 从 [1,n-1]分别的值为多少。解题思路:dfs 求....
分类:
其他好文 时间:
2015-03-12 20:45:45
阅读次数:
183
DescriptionFarmer John has built a new long barn, with N (2 <= N <= 100,000) stalls. The stalls are located along a straight line at positions x1,…,xN (0 <= xi <= 1,000,000,000).His C (2 <= C <= N) cow...
分类:
其他好文 时间:
2015-03-12 19:20:32
阅读次数:
243