原题地址:http://codeforces.com/problemset/problem/383/A 题目大意:有 n 头奶牛,全部看着左边或者右边,现在开始给奶牛挤奶,给一头奶牛挤奶时,所有能看到它的奶牛会损失一升奶,已经挤过的奶牛不会再损失,求一种挤奶顺序,使得失去的牛奶数最少.(1 <= n <= 200000) 题目分析:考场上看到它的时候想:这不就是一个裸的线段树么……但是由于线段树不熟就没写出来……考完参照网上一些解法发现自己真的是想多了……唉……原来是贪心 我们需要证明以下一个…
Milking Cows Three farmers rise at 5 am each morning and head for the barn to milk three cows. The first farmer begins milking his cow at time 300 (measured in seconds after 5 am) and ends at time 1000. The second farmer begins at time 700 and ends a…
A. Milking cows time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Iahub helps his grandfather at the farm. Today he must milk the cows. There are n cows sitting in a row, numbered from 1 to n…
Three farmers rise at 5 am each morning and head for the barn to milk three cows. The first farmer begins milking his cow at time 300 (measured in seconds after 5 am) and ends at time 1000. The second farmer begins at time 700 and ends at time 1200.…