311 - Packets
Moderator: Board moderators
-
- New poster
- Posts: 2
- Joined: Tue Apr 23, 2002 1:16 am
- Contact:
311 - Packets
Hi,
I've been having problems submitting the solution to 311 - Packets to the Judge. It keeps saying "Wrong Answer", but I don't think the answers are wrong. Can anyone supply me with a test file or something?
Thanks,
I've been having problems submitting the solution to 311 - Packets to the Judge. It keeps saying "Wrong Answer", but I don't think the answers are wrong. Can anyone supply me with a test file or something?
Thanks,
V
-
- New poster
- Posts: 2
- Joined: Tue Apr 23, 2002 1:16 am
- Contact:
I've got it
Thank you for your reply, but I analysed the code better and already found what I was doing wrong and fixed it. Now the judge accepted it.
Thanks anyway,
V
Thanks anyway,
V
V
I am having the same problem - I believe the program works OK,
but judge returns me WA. Can somebody provide some inputs/outputs?
These are some outputs my program returns:
INPUT:
0 0 4 0 0 1
7 5 1 0 0 0
11 12 13 14 15 16
10 10 10 10 10 10
5000 1400 300 200 100 100
0 0 0 0 0 0
OUTPUT:
2
1
49
33
550
Is this code for reading input OK?:
{main block:}
begin
repeat
Read(p1, p2, p3, p4, p5, p6);
if p1 = 0 then if p2 = 0 then if p3 = 0 then if p4 = 0 then if p5 = 0 then if p6 = 0 then Break;
//else:
Solve;
Writeln(Solution);
until False;
end.
but judge returns me WA. Can somebody provide some inputs/outputs?
These are some outputs my program returns:
INPUT:
0 0 4 0 0 1
7 5 1 0 0 0
11 12 13 14 15 16
10 10 10 10 10 10
5000 1400 300 200 100 100
0 0 0 0 0 0
OUTPUT:
2
1
49
33
550
Is this code for reading input OK?:
{main block:}
begin
repeat
Read(p1, p2, p3, p4, p5, p6);
if p1 = 0 then if p2 = 0 then if p3 = 0 then if p4 = 0 then if p5 = 0 then if p6 = 0 then Break;
//else:
Solve;
Writeln(Solution);
until False;
end.
-
- Experienced poster
- Posts: 192
- Joined: Sat Nov 30, 2002 5:14 am
I tried to solve the last input myself, and I got this:
var p1, p2, p3, p4, p5, p6: Integer; // p1 is number of packets of size 1x1, p2 is 2x2 etc.
{ This one is for 6x6 }
Result := 100;
{ This one is for 5x5.
Because we can put 5 packets of size 2x2 and
one of size 1x1, we decrease the number of p1 and p2: }
Inc(Result, 100);
Dec(p2, 5*100);
Dec(p1, 100);
{ This one is for 4x4. Each 4x4 packet
must be in it's own parcel. There is enough
room in the parcels for 900 2x2 packets
and 110*20 1x1 packets: }
Inc(Result, 200);
Dec(p2, 90*10); // Now there is no 2x2 packets left!
Dec(p1, 110*20);
{ this one is for 3x3. 4 3x3 packets go in one parcel,
and because 300 div 4 is 75, there is no room for
other packets of size 1x1 (we already used all of 2x2): }
Inc(Result, 75);
{ The last one is for 1x1. We already used all of 2x2.
We have 2700 of those packets left, each parcel can contain
36 of those. 2700 div 36 is exactly 75.}
Inc(Result, 75);
And the solution is:
Result = 100 + 100 + 200 + 75 + 75 = 550
Where did I make mistake? Did I misunderstood the problem?
var p1, p2, p3, p4, p5, p6: Integer; // p1 is number of packets of size 1x1, p2 is 2x2 etc.
{ This one is for 6x6 }
Result := 100;
{ This one is for 5x5.
Because we can put 5 packets of size 2x2 and
one of size 1x1, we decrease the number of p1 and p2: }
Inc(Result, 100);
Dec(p2, 5*100);
Dec(p1, 100);
{ This one is for 4x4. Each 4x4 packet
must be in it's own parcel. There is enough
room in the parcels for 900 2x2 packets
and 110*20 1x1 packets: }
Inc(Result, 200);
Dec(p2, 90*10); // Now there is no 2x2 packets left!
Dec(p1, 110*20);
{ this one is for 3x3. 4 3x3 packets go in one parcel,
and because 300 div 4 is 75, there is no room for
other packets of size 1x1 (we already used all of 2x2): }
Inc(Result, 75);
{ The last one is for 1x1. We already used all of 2x2.
We have 2700 of those packets left, each parcel can contain
36 of those. 2700 div 36 is exactly 75.}
Inc(Result, 75);
And the solution is:
Result = 100 + 100 + 200 + 75 + 75 = 550
Where did I make mistake? Did I misunderstood the problem?
-
- Experienced poster
- Posts: 192
- Joined: Sat Nov 30, 2002 5:14 am
Hi!
The problem is to count how many packets of size 6x6 that can fit all the delivery packets (size 1x1, 2x2, 3x3, 4x4, 5x5, 6x6).
Maximum capacity of box :
1. The box can packed only 1 parcel of size 6x6.
2. The box can packed only 1 parcel of size 5x5 + 11 parcel of size 1 x 1.
3. The Box can packed only 1 parcel of size 4x4 +5 parcel of size 2x2 + remain 1x1 parcels
and so on for packed 3x3 boxes, 2x2, 1x1.
Hope this helps.
[/b][/quote]



The problem is to count how many packets of size 6x6 that can fit all the delivery packets (size 1x1, 2x2, 3x3, 4x4, 5x5, 6x6).
(All box (Square parcel to be delivered) size are 6x6)."These products are always delivered to customers in the square parcels of the same height h as the products have and of the size 6x6"
Maximum capacity of box :
1. The box can packed only 1 parcel of size 6x6.
2. The box can packed only 1 parcel of size 5x5 + 11 parcel of size 1 x 1.
Code: Select all
---------------------------------------------
| * | * | * | * | * | |
---------------------------------------------
| * | * | * | * | * | |
---------------------------------------------
| * | * | * | * | * | |
---------------------------------------------
| * | * | * | * | * | |
---------------------------------------------
| * | * | * | * | * | |
---------------------------------------------
| | | | | | |
----------------------------------------------
*)There are 11 empty square
and so on for packed 3x3 boxes, 2x2, 1x1.
Hope this helps.


Hi,
I always get WA for this problem.
Could someone please give me the outputs for these inputs:
Thanks,
Regards,
angga888

I always get WA for this problem.

Could someone please give me the outputs for these inputs:
Or maybe there are some tricky inputs?1 2 3 0 0 0
0 4 2 0 100 0
71 55 113 33 19 19
123 1420 1616 1321 101 0
9999 9999 9999 9999 999 999
731 165 9975 1235 874 11
1500 3000 1000 500 200 1
Thanks,
Regards,
angga888

Hi Betalord...
For input 731 165 9975 1235 874 11
your output is 5520.
But if I count it by myself, I found:
Thanks,
Regards,
angga888

For input 731 165 9975 1235 874 11
your output is 5520.
But if I count it by myself, I found:
Maybe I misunderstood the problem? Please help me.Let number of packets size 1x1 = n[1]
2x2 = n[2]
3x3 = n[3]
...
6x6 = n[6]
So, I think that at least we need :
- n[6] (11) parcels.
-> n[1],n[2],n[3],n[4],n[5],n[6]=731,165,9975,1235,874,0
-> total parcels needed = 11.
- n[5] (874) parcels, and decrease(n[1],874*11) --> so n[1]=0.
(because every parcel can packed only 1 packet 5x5 + 11 packets 1x1).
-> n[1],n[2],n[3],n[4],n[5],n[6]=0,165,9975,1235,0,0
-> total parcels needed = 885.
- n[4] (1235) parcels, and decrease(n[2],1235*5) --> n[2]=0.
(because every parcel can packed only 1 packet 4x4 + 5 packets 2x2
or packet 1x1 if we still have).
-> n[1],n[2],n[3],n[4],n[5],n[6]=0,0,9975,0,0,0
-> total parcels needed = 2120.
- n[3]/4 (9975/4) parcels.
(because every parcel can packed only 4 packets 3x3, here we don't have
another packets of any size except this 3x3 size)
-> n[1],n[2],n[3],n[4],n[5],n[6]=0,0,3,0,0,0
-> total parcels needed = 4613.
- so there are only 3 packets of size 3x3 left so I added them to 1 parcels.
-> n[1],n[2],n[3],n[4],n[5],n[6]=0,0,0,0,0,0
-> total parcels needed = 4614.
And total number of parcels nedded = 4614.

Thanks,
Regards,
angga888

You understand the problem OK, I am the one who made a mistake.
Numbers in your input are quite big, so they caused a problem in
my algorithm, because I am using Integers (max=32767) and when
multiplying, this numbers get over the limit.
Here are correct outputs:
2
102
100
1826
14497
4614
1007
But ACM does not use such big numbers in their input data, so that
should not be a problem.
Regards,
Betalord
Numbers in your input are quite big, so they caused a problem in
my algorithm, because I am using Integers (max=32767) and when
multiplying, this numbers get over the limit.
Here are correct outputs:
2
102
100
1826
14497
4614
1007
But ACM does not use such big numbers in their input data, so that
should not be a problem.
Regards,
Betalord