
	PARTY - SOLUTIE
       -----------------

by Jozef Tvarozek

Since the friendship is symmetric, the graph itself provides you 
compared to
its spanning tree no additional
information. Thus you can construct its spanning tree in O(M*C) time; C 
is a
constant required by one call of
union-find procedure when you use these funny improvements like path
compression, etc. Now you have M
number of edges proportional to N. Thus you can apply your algorithm. 
I,
personally, have for convenience
made an O(M+N) in time and 4*int*N (approx. 200kB) in memory algorithm; 
Im
paring up the terminal
vertices (and removing them afterwards).

