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 1056. Centers of the Net

Hint O(n^2)
Posted by Hanzbrow (TNU) KCC 28 Oct 2009 20:12
vector<set<int> >


and if WA 5 then test this:
9
1 2 3 4 5 6 7 8

and

10
1 2 3 4 5 6 7 8 9
Re: Hint O(n^2)
Posted by Roman Rubanenko 16 Apr 2010 21:14
Hmmmmm....
O(n^2) is too slow (-_-).
I know  O(N+M) solution.You have just to delte leaves, while number of vertex>2.If you will do it righ,you will get O(N+M)solution.