Page 2 of 2
Re: 10051
Posted: Sun Aug 30, 2009 5:06 pm
by Angeh
Yaron Wittenstein wrote:I want to solve this problem by building a graph and running
topological sort on it and then finding the longest path in the graph.
now for a dense graph I get E = V^2
where V <= 6 * 500 right? (6 positions and 500 cubes maximum)
so (6*500)^2 is too much space isn't? (for int array)
there is another option? (I guess they dont expect me to work
in bits level)
please help me here, or tell me another option for solving
this question.
there is no need to construct a whole graph just keep the track
for each node instead of
finding its children
find the nodes that can be its parent

10051 - Tower of Cubes
Posted: Sun Aug 30, 2009 11:14 pm
by Angeh
This is not so Difficult to solve
I solved it by O(n) algorithm and Got AC
the only thing needed is to change you mind set on an other thing

Re: 10051 - Tower of Cubes
Posted: Sun Jul 22, 2012 6:25 am
by Neil
Is it just me, or is this problem statement more than a little contradictory?
It says "Print a blank line between two successive test cases" but the sample output doesn't have any blank lines.
It also says that we should print the identification string of the top face, but the sample output shows the bottom face.
Am I missing something???
Re: 10051 - Tower of Cubes
Posted: Tue Jul 24, 2012 12:00 am
by brianfry713
Yes there is a blank line between test cases.
Note that there may be multiple solutions and any one of them is acceptable.
Re: 10051 - Tower of Cubes
Posted: Fri Jul 27, 2012 5:26 am
by Neil
Oh I didn't see the part that says the list is from top to bottom - I thought it was bottom to top.
Thanks, got accepted now
