Description Farmer John's N (1 <= N <= 50,000) cows (numbered 1..N) are planning to run away and join the circus. Their hoofed feet prevent them from tightrope walking and swinging from the trapeze (and their last attempt at firing a cow out of a ca…
Description Farmer John's N (1 <= N <= 50,000) cows (numbered 1..N) are planning to run away and join the circus. Their hoofed feet prevent them from tightrope walking and swinging from the trapeze (and their last attempt at firing a cow out of a ca…
一开始是往二分上去想的,如果risk是x,题目要求则可以转化为一个不等式,Si + x >= sigma Wj ,j表示安排在i号牛上面的牛的编号. 如果考虑最下面的牛那么就可以写成 Si + x ≥ sum W - Wi,为了方便处理把i号牛的信息合并到一起 → Si + Wi + x ≥sum W. 二分x的时候,x是个常量,而从下面往上去安排牛的时候,下面的牛是没有影响决策的,可以看成把Wi去掉. 于是得到一个贪心的选法,把牛按照Si+Wi排序,从下面往上安排牛,可选择的牛应该满足Si+…
题目链接:http://poj.org/problem?id=3045 Cow Acrobats Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 5713 Accepted: 2151 Description Farmer John's N (1 <= N <= 50,000) cows (numbered 1..N) are planning to run away and join the circus. The…
Cow Acrobats Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 2302 Accepted: 912 Description Farmer John's N (1 <= N <= 50,000) cows (numbered 1..N) are planning to run away and join the circus. Their hoofed feet prevent them from tigh…
1629: [Usaco2007 Demo]Cow Acrobats Time Limit: 5 Sec Memory Limit: 64 MBSubmit: 601 Solved: 305[Submit][Status] Description Farmer John's N (1 <= N <= 50,000) cows (numbered 1..N) are planning to run away and join the circus. Their hoofed feet pre…