2020 Dec Silver Rectangular Pasture

For the Dec 2020 Silver Problem 2, Rectangular Pasture, I have an O(n^4) algorithm which solves only the first few test cases. I can’t find any insights to speed it up. Could anyone give me a hint? Like, before I look at the official solution I really want to have the key insight myself but I need a hint.

Say you had two boundaries. How would you determine how many subsets of cows can be enclosable with fences that stick to those two boundaries?

1 Like

thank you! wow it only took an hour to get a hint. what a lovely community you are. I will think about this.

I suggest you think about how you would define a subset if say, you fix the boundaries like @SansPapyrus683 said.

I don’t think it was meant to be that way(?)

Please disregard the flag (above). I misunderstood the comment.

Many forums on the internet are low activity or low quality of posting. I’m new to this forum so I didn’t have much hope I would get a good hint at all, let alone so quickly. I see that I need to recalibrate my expectations - a wonderful forum.

1 Like

Yeah, sorry for the misunderstanding. My bad. The way you phrased the comment usually implies sarcasm.

It was a slight manic way to phrase the comment, so my bad too.