Video Game ZCO('14) (Its URGENT)

by the where did u run and test the code?

Why are you using long long ? All integers are within 32 bit int limits. Follow KISS. Keep it simple stupid. Why are you first reading commands storing it as a vector and then following them. Read it and follow it. Give you variables long names. Just long enough that you are never confused. I just did the problem minutes ago so here’s the strategy. You should use only 1 array to store value of stack height, 4 ints for crane position, max height, no of stacks of boxes & current command & a boolean for whether the crane holds the box. Try it again. Do you want the solution or help to solve?

swargatochatt thanks for this but can u please post the suitable code so that i could get it checked by the online judge… I think it’ll be much more helpful

@aaha97 whom are u referring to?

@kshitijkmr10 Someone has taken the time and effort to give you a pseudocode and you want the entire code just to get it accepted by the judge? :open_mouth: It’s less helpful if you want it that way.

thanks a lot; i m still trying n i promise i’ll not see your code till the time i am unable to run my own code!. thanks a lot once again @organic shilling n i think i 've got to know the faults . M trying the way u told earlier.

n guess what finally my code ran successfully! 100/100 thanks to your advice :-D… @Organic-Shilling … By the way r u participating in zco?

yes! It would be wrong to print only box[i] without adding any space between them!

might help if u tell your approach/algo. I am unable to understand the algo you used.