688 - Mobile Phone Coverage

All about problems in Volume 6. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Post Reply
ei01036
New poster
Posts: 12
Joined: Wed Jan 15, 2003 1:13 am

688 - Mobile Phone Coverage

Post by ei01036 »

Hi everyone!

I'm not managing to get AC in this one... It seems fairly easy though. My program handles correctly the sample input, the problems stated in the fix page of the problem and some other cases. Among these I included some samples with overlapping sides and points of the squares...

I can't remember anything else...

If anyone knows of something, please help! Thanks!
sohel
Guru
Posts: 856
Joined: Thu Jan 30, 2003 5:50 am
Location: New York

Post by sohel »

The best method to solve this probelm is to transform the given rectangles into many stripes.

First sort by x coordinates and sort the smaller rectangles(for every consecutive x interval) considering y coordinate. Add them up and you get the required answer.

This statement might seem very confusing but read it carefully and you will get the theme of it.
sclo
Guru
Posts: 519
Joined: Mon Jan 23, 2006 10:45 pm
Location: Vancouver, BC, Canada
Contact:

Post by sclo »

There's at least 2 ways I can think of to solve it. The easy way is to normalize the coordinates and just count the sum of area of rectangles that has at least one square covering it. The other way, which works for input size at much as 500000 is to use the sweep line algorithm for finding area of unions of orthogonal rectangles. Just look it up in any computational geometry textbook.
Post Reply

Return to “Volume 6 (600-699)”