10051 - Tower of Cubes

All about problems in Volume 100. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Angeh
Experienced poster
Posts: 108
Joined: Sat Aug 08, 2009 2:53 pm

Re: 10051

Post by Angeh » Sun Aug 30, 2009 5:06 pm

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 :)
>>>>>>>>> A2
Beliefs are not facts, believe what you need to believe;)

Angeh
Experienced poster
Posts: 108
Joined: Sat Aug 08, 2009 2:53 pm

10051 - Tower of Cubes

Post by Angeh » Sun Aug 30, 2009 11:14 pm

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 :D
>>>>>>>>> A2
Beliefs are not facts, believe what you need to believe;)

Neil
New poster
Posts: 8
Joined: Fri Jun 22, 2012 7:04 am

Re: 10051 - Tower of Cubes

Post by Neil » Sun Jul 22, 2012 6:25 am

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???

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 10051 - Tower of Cubes

Post by brianfry713 » Tue Jul 24, 2012 12:00 am

Yes there is a blank line between test cases.
Note that there may be multiple solutions and any one of them is acceptable.
Check input and AC output for thousands of problems on uDebug!

Neil
New poster
Posts: 8
Joined: Fri Jun 22, 2012 7:04 am

Re: 10051 - Tower of Cubes

Post by Neil » Fri Jul 27, 2012 5:26 am

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 :)

Post Reply

Return to “Volume 100 (10000-10099)”