- 题目大意 农夫约翰搭了一间有n间牛舍的小屋。牛舍排在一条线上第i号牛舍在xi的位置。但是他的m头牛对小屋很不满意,因此经常互相攻击。约翰为了防止牛之间互相伤害,因此决定把每头牛都放在离其他牛尽可能远的牛舍。 - 解题思路 很明显是一个最大值最小化的问题,因此我们可以假设C(d)为满足所有牛之间的 ...
分类:
其他好文 时间:
2018-02-15 13:18:34
阅读次数:
201
题目描述 FJ's N (1 ≤ N ≤ 10,000) cows conveniently indexed 1..N are standing in a line. Each cow has a positive integer height (which is a bit of secret). ...
分类:
其他好文 时间:
2018-02-14 18:19:32
阅读次数:
185
题目描述 Farmer John's NNN cows are standing in a row, as they have a tendency to do from time to time. Each cow is labeled with a distinct integer ID num ...
分类:
其他好文 时间:
2018-02-14 15:36:03
阅读次数:
173
Popular Cows 题意:一共有n头牛,m条崇拜关系,并且崇拜关系是可以传递的,偶像的偶像也是自己的偶像,求被除自己以外被其他所有牛崇拜的牛的数量。 题解:将强连通图缩成点,找到出度为0的点,如果有2个及以上就不能达成条件,如果只有一个,那么代表着其他点都有出去的边,且因为强连通锁点了,所以定 ...
分类:
其他好文 时间:
2018-02-12 13:37:56
阅读次数:
169
Gold Balanced Lineup Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 16467 Accepted: 4664 Description Farmer John's N cows (1 ≤ N ≤ 100,000 ...
分类:
其他好文 时间:
2018-02-11 10:52:55
阅读次数:
197
题目:http://poj.org/problem?id=2182 从后往前确定,自己位置之前没有被确定的且比自己编号小的个数+1即为自己的编号; 利用树状数组快速查找,可另外开一个b数组,角标为编号大小,而其值为是否使用,二分查找到恰好满足条件的位置,向后一直找到没被用过的第一个编号即为此位置编号 ...
分类:
编程语言 时间:
2018-02-11 00:10:42
阅读次数:
183
RT 找工就业 Bessie is running out of money and is searching for jobs. Farmer John knows this and wants the cows to travel around so he has imposed a rule ...
分类:
其他好文 时间:
2018-02-07 12:10:37
阅读次数:
207
P2854 [USACO06DEC]牛的过山车Cow Roller Coaster 题目描述 The cows are building a roller coaster! They want your help to design as fun a roller coaster as possib ...
分类:
其他好文 时间:
2018-02-06 20:36:52
阅读次数:
193
P1825 [USACO11OPEN]玉米田迷宫Corn Maze P1825 [USACO11OPEN]玉米田迷宫Corn Maze P1825 [USACO11OPEN]玉米田迷宫Corn Maze 题目描述 This past fall, Farmer John took the cows t ...
分类:
其他好文 时间:
2018-02-04 18:10:53
阅读次数:
194
题目描述 Farmer John has noticed that the quality of milk given by his cows varies from day to day. On further investigation, he discovered that although ...
分类:
其他好文 时间:
2018-02-04 16:45:50
阅读次数:
153