ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1701. Ostap and Partners

Is there O(N+M) solution?
Posted by VNTU Vitaly(Traning) 1 Sep 2009 04:22
Re: Is there O(N+M) solution?
Posted by ASK 16 Nov 2010 01:46
almost: use Disjoint-set forests (see, e.g., http://en.wikipedia.org/wiki/Disjoint-set_data_structure) for inspiration