Given n circles n <= 1000, how can I find the area of union of all this circles?

Before contest

Codeforces Round #518 (Div. 1) [Thanks, Mail.Ru!]

23:09:21

Register now »

Codeforces Round #518 (Div. 1) [Thanks, Mail.Ru!]

23:09:21

Register now »

*has extra registration

Before contest

Codeforces Round #518 (Div. 2) [Thanks, Mail.Ru!]

23:09:21

Register now »

Codeforces Round #518 (Div. 2) [Thanks, Mail.Ru!]

23:09:21

Register now »

*has extra registration

# | User | Rating |
---|---|---|

1 | tourist | 3581 |

2 | OO0OOO00O0OOO0O0…O | 3264 |

3 | mnbvmar | 3246 |

4 | LHiC | 3183 |

5 | Um_nik | 3176 |

6 | Petr | 3161 |

7 | Radewoosh | 3128 |

8 | CongLingDanPaiSh…5 | 3116 |

9 | ainta | 3115 |

9 | ko_osaga | 3115 |

# | User | Contrib. |
---|---|---|

1 | Radewoosh | 191 |

2 | Errichto | 166 |

3 | rng_58 | 161 |

4 | tourist | 158 |

5 | Vovuh | 150 |

5 | Um_nik | 150 |

7 | Petr | 149 |

7 | Swistakk | 149 |

9 | 300iq | 148 |

10 | PikMike | 147 |

10 | neal | 147 |

Given n circles n <= 1000, how can I find the area of union of all this circles?

↑

↓

Codeforces (c) Copyright 2010-2018 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Oct/23/2018 20:25:41 (f1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|

I'm interested in that kind of problem too..! http://www.spoj.pl/problems/VCIRCLES/ is a small version but the big one is http://www.spoj.pl/problems/CIRU/

The main idea here is to make a vertical decomposition: draw a vertical line through every point of two circles' intersection and through two points with maximal and minimal x of every circle. Hence, you'll have O(N^2) vertical bands. In each band you have something like brackets (arcs) sequence so you can skip inner brackets. At last, you have some trapezoids with arc as side edges. Their area can be easily found in many ways.

please describe any of them....

How do you do the "easy" part in less than O(N)? :)

There is a way, I think. But I never implemented it myself. You can try to build planar graph where vertices are points of circles intersections and edges are arcs. Then you can use standard algorithm for finding the area of faces of the planar graph. The only problem is how to sort edges, connected to one vertex. I am not sure about how do it correctly.

are there questions based on area similar to this on CodeForces?

You can try this (not exactly same but similar): https://codeforces.com/contest/814/problem/D

This problem can be solved with Green’s Theorem : Find the arcs which lies in the border of the union of area (in n^2lgn time with sweep), and apply the formula directly.