Hi,

I couldn't understand this problem from the editorial

https://codeforces.com/contest/217/problem/A

Can someone please explain how it's a bipartite graph

Thx

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

1 | Benq | 3783 |

2 | jiangly | 3666 |

3 | tourist | 3611 |

4 | Um_nik | 3536 |

5 | inaFSTream | 3477 |

6 | fantasy | 3468 |

7 | maroonrk | 3464 |

8 | QAQAutoMaton | 3428 |

9 | ecnerwala | 3427 |

10 | Ormlis | 3396 |

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

1 | Um_nik | 185 |

2 | adamant | 178 |

3 | awoo | 177 |

4 | nor | 169 |

5 | maroonrk | 165 |

6 | -is-this-fft- | 164 |

7 | antontrygubO_o | 153 |

8 | ko_osaga | 151 |

9 | dario2994 | 150 |

10 | SecondThread | 149 |

Hi,

I couldn't understand this problem from the editorial

https://codeforces.com/contest/217/problem/A

Can someone please explain how it's a bipartite graph

Thx

↑

↓

Codeforces (c) Copyright 2010-2023 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: May/31/2023 22:46:56 (l1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|

The editorial says that you should divide points into groups such that in each group any pair of points are reachable from each other (maybe indirectly). If two points are on the same X- or Y- line, they should be in the same group. The answer is the number of groups minus one.

Example: 5 3 3 4 1 6 2 1 1 1 4

There are 3 groups: 1st: 4 1 1 1 1 4

2nd: 3 3

3rd: 6 2

Points 1 4 and 4 1 are reachable from each other because you can from one point first get to 1 1 and then to the other.