Codeforces Round #340 Watering Flowers】的更多相关文章

题目: http://www.codeforces.com/contest/617/problem/C 自己感觉是挺有新意的一个题目, 乍一看挺难得(= =). 其实比较容易想到的一个笨办法就是:分别计算出每个点到喷泉的距离,然后分别按照距离远近排序(要用到两个数组),然后选定一个喷泉,从近到远依次选点,然后标记该点,从另一个喷泉中找到距离他最远且还没用被标记的点,这个距离加前一个喷泉的距离就是要求的答案,选最小的即可,n方的时间复杂度. 需要注意的几点: 1.         对于每个点最好用…
[Codeforces Round #340 (Div. 2)] vp了一场cf..(打不了深夜的场啊!!) A.Elephant 水题,直接贪心,能用5步走5步. B.Chocolate 乘法原理计数,统计连续的“0”到下一个“1”的个数,然后相乘(第一个1前面的0不能算上).当然还要特判全0的情况. C.Watering Flowers 这题1A.只要按照以到某一个喷泉的距离排序,然后枚举没有被这一个喷泉覆盖到的个数,然后通过第二个喷泉覆盖,贪心一下就好了. D.Polyline 题意杀,还…
C. Watering Flowers 题目连接: http://www.codeforces.com/contest/617/problem/C Descriptionww.co A flowerbed has many flowers and two fountains. You can adjust the water pressure and set any values r1(r1 ≥ 0) and r2(r2 ≥ 0), giving the distances at which t…
题意与分析 (CodeForces 617C) 题意是这样的:一个花圃中有若干花和两个喷泉,你可以调节水的压力使得两个喷泉各自分别以\(r_1\)和\(r_2\)为最远距离向外喷水.你需要调整\(r_1,r_2\)的值使得所有的花都能被水所灌溉--换句话说,每一朵花要么到第一个喷泉的距离不超过\(r_1\),要么到第二个喷泉的距离不超过\(r_2\).当然如果两个条件都满足也是可以的.你需要用尽可能少的水来实现以上要求,也就是说使得\(r_1^2+r_2^2\)尽可能的小.找出这个最小值. 那么…
E. XOR and Favorite Number 题目连接: http://www.codeforces.com/contest/617/problem/E Descriptionww.co Bob has a favorite number k and ai of length n. Now he asks you to answer m queries. Each query is given by a pair li and ri and asks you to count the n…
B. Chocolate 题目连接: http://www.codeforces.com/contest/617/problem/D Descriptionww.co Bob loves everything sweet. His favorite chocolate bar consists of pieces, each piece may contain a nut. Bob wants to break the bar of chocolate into multiple pieces…
A. Elephant 题目连接: http://www.codeforces.com/contest/617/problem/A Descriptionww.co An elephant decided to visit his friend. It turned out that the elephant's house is located at point 0 and his friend's house is located at point x(x > 0) of the coord…
D. Polyline 题目连接: http://www.codeforces.com/contest/617/problem/D Descriptionww.co There are three points marked on the coordinate plane. The goal is to make a simple polyline, without self-intersections and self-touches, such that it passes through…
任意门:http://codeforces.com/problemset/problem/617/E E. XOR and Favorite Number time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output Bob has a favorite number k and ai of length n. Now he asks yo…
Description A flowerbed has many flowers and two fountains. You can adjust the water pressure and set any values r1(r1 ≥ 0) and r2(r2 ≥ 0), giving the distances at which the water is spread from the first and second fountain respectively. You have to…