103 - Stacking Boxes

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

Moderator: Board moderators

Post Reply
New poster
Posts: 1
Joined: Mon Apr 08, 2002 4:28 am

103 - Stacking Boxes

Post by --X-- » Mon Apr 08, 2002 4:34 am

Does anyone have an insight into some trick the judges input may have. The problem is a straightforward longest path algorithm, which makes me wonder why I keep getting WA.

Thnx for any help

New poster
Posts: 4
Joined: Fri Apr 05, 2002 2:00 am
Location: HeBei,China

Post by FireDragon » Tue Apr 09, 2002 3:34 am

Your algorithm is the same as mine----1)Sort the boxes' dimensions 2)Get the longest path.And My solution was accepted two days ago.

New poster
Posts: 16
Joined: Wed Jan 16, 2002 2:00 am

It may be helpful

Post by chang » Wed Apr 10, 2002 7:05 pm

It was my mistake:when the maximum no of box is 1... I printed 0 wronlgly...
Did u check this input....

New poster
Posts: 9
Joined: Fri Apr 12, 2002 2:27 am

Post by hsihsiwu » Sat Apr 13, 2002 8:34 am

If input is 6 1, what is answer?

Experienced poster
Posts: 137
Joined: Wed Feb 27, 2002 2:00 am
Location: Pasadena, CA

Post by C8H10N4O2 » Sun Apr 14, 2002 3:54 pm

If input is

Code: Select all

6 1
Output should be

Code: Select all


New poster
Posts: 9
Joined: Fri Apr 12, 2002 2:27 am

Post by hsihsiwu » Tue Apr 16, 2002 11:29 pm

Thanks. I got it.

New poster
Posts: 1
Joined: Fri May 24, 2002 4:36 am
Location: University of Alberta

103 - Why does it time out?

Post by ositruc » Fri May 24, 2002 4:39 am

My program seems to work for any test case I give it, within the boundaries specified by the problem statement. However when I submit my code the online-judge times out. Does anyone have any idea what input they are using that could time out my program?
"Arrrrr! I'm a pirate!"

New poster
Posts: 1
Joined: Wed May 29, 2002 3:34 am

103 yellow check mark???

Post by amadeus082 » Wed May 29, 2002 3:42 am

What exactly does the yellow check mark mean next to the problem? Apparently it's affecting my program because it works for every test case I use, but got wrong answer from the judge. Does any know any special things in the input?


Learning poster
Posts: 64
Joined: Sun Jan 06, 2002 2:00 am
Location: Hungary

Post by ftomi » Wed May 29, 2002 9:37 am

The yellow colour means a special correction program for that problem. It's because there are more solution.

Melon Melon
New poster
Posts: 17
Joined: Fri May 31, 2002 6:30 pm

Question on 103

Post by Melon Melon » Fri May 31, 2002 6:38 pm

[c] :oops:
Would anyone give me hints on solving question 103??
I have that a silly way to do it, but don't know how to continue it or my way is wrong.
I first sort the dimensions of each box and then try to find out each boxes which can hold the next box......but if I do in this way, the codes will be very complicated.
Could anyone help me, please?[/c]

Experienced poster
Posts: 144
Joined: Thu Nov 22, 2001 2:00 am
Location: Gdynia, Poland


Post by cyfra » Fri May 31, 2002 6:47 pm


Yes of course you have good idea....

Just try to look at this problem as a graph...
( But you will not have to implement it :wink: )
so there is a line beetween two boxes if you can put one into another..

This graph is one-way graph and it has no cycles...

So now you have only to count the longest path in such a graph...
Which is quite easy...

So don't worry that your program will be very complicated..
It only has to work :D

Good Luck :wink:


Next time try not to use table for C code for normal writing..

Melon Melon
New poster
Posts: 17
Joined: Fri May 31, 2002 6:30 pm

Thanks a lot!!! ^^

Post by Melon Melon » Fri May 31, 2002 6:57 pm


New poster
Posts: 33
Joined: Thu Jun 20, 2002 1:18 pm


Post by obayashi » Thu Jun 20, 2002 1:21 pm

maybe u use brute force to search for the result.

post yr code here pls...
Time makes a fool of memory
And yet my memories still shine

Experienced poster
Posts: 132
Joined: Sun Apr 14, 2002 12:27 pm
Location: Russia

103 DP

Post by Revenger » Thu Jun 20, 2002 2:14 pm

You must use DP or DFS to solve this problem. If realy want help then post your source code.

New poster
Posts: 47
Joined: Fri Jun 21, 2002 3:08 pm

Post by dawynn » Mon Jun 24, 2002 7:35 pm

Does anyone have any suggestions on tricky cases to try?

Post Reply

Return to “Volume 1 (100-199)”