The answer is just the value of C(n+v-1,v-1)+C(n+v-3,v-1)+C(n+v-5,v-1)+...+C(v or v-1,v-1).
I caculated it directly and my program got ACed in 1.9x(sec). rather slow
But many people's programs used much less time. I wonder how they made it.
I dunno why i've got wa. :( If the number of different x is smaller than the number of different y, I will turn the plane. Maybe it can make the program more efficient. [pascal] Program Counting_Rectangles;
Const Maxn=5000;
Type TPoint=Record x,y:Longint; End; TLink=^TNode; TNode=Record ...
My algorithm is: 1. Since covering the entire strip and covering the upper bound are equivalent, each sprinkler can be represented by an interval. 2. Use GREEDY algorithm to solve it. Is it correct? I think so, but why did I got WA. [pascal] Program Watering_Grass;