## 10344 - 23 out of 5

Moderator: Board moderators

A correction.

The input file format is correct (I verified it using a bunch of asserts). All numbers are positive integers between 1 and 50. I don't really know what your phrase "value may be long" wanted to say... but all intermediate results will surely fit into a int.

The only change I had to make in my (previously correct and AC, currently WA) code to get it accepted is to change
"output whether 23 can be reached"
to
"output whether 23 or -23 can be reached".

Oh boy, I wonder why they bothered to "rejudge" the problem
misof
A great helper

Posts: 430
Joined: Wed Jun 09, 2004 1:31 pm

misof wrote:but all intermediate results will surely fit into a int.

Suppose a1=50,a2=50,a3=50,a4=50,a5=50

If u use normal backtracking then
intermediate result will be a1*a2*a3*a4*a5 which will not fit into int.
Mr. Arithmetic logic Unit
TISARKER
Learning poster

Posts: 88
Joined: Tue Oct 12, 2004 6:45 pm

50^5 is only 312500000, which quite well fits in an 'int' (32-bit, of course)
mf
Guru

Posts: 1244
Joined: Mon Feb 28, 2005 4:51 am
Location: Zürich, Switzerland

mf wrote:50^5 is only 312500000, which quite well fits in an 'int' (32-bit, of course)

mf,
I am really sorry for not clarifying my statement.
I only wanted to say that use long type variable(32 bit) instead of int type variable (16 bit).
Mr. Arithmetic logic Unit
TISARKER
Learning poster

Posts: 88
Joined: Tue Oct 12, 2004 6:45 pm

TISARKER wrote:
mf wrote:50^5 is only 312500000, which quite well fits in an 'int' (32-bit, of course)

mf,
I am really sorry for not clarifying my statement.
I only wanted to say that use long type variable(32 bit) instead of int type variable (16 bit).

gcc/g++ used by the judge is a 32-bit compiler, i.e., ints are 32-bit signed integers. If you still use a compiler that has 16-bit ints, you really should upgrade to a newer one. (Take a look at http://www.bloodshed.net/devcpp.html and/or http://www.delorie.com/djgpp/ )
misof
A great helper

Posts: 430
Joined: Wed Jun 09, 2004 1:31 pm

mf, A lot of thanks.
Mr. Arithmetic logic Unit
TISARKER
Learning poster

Posts: 88
Joined: Tue Oct 12, 2004 6:45 pm

I'm very confused. Why do we care about -23? After the rejudging, my AC solution turned into a WA solution. Like misof, I changed the 'if' statement from
Code: Select all
`if( r == 23 )`

to
Code: Select all
`if( r == 23 || r == -23 )`

and got AC.

Why? Could anyone explain it please?
Let's hope Yury doesn't notice that I'm solving problems again.

Abednego
A great helper

Posts: 281
Joined: Tue Sep 10, 2002 5:14 am
Location: Mountain View, CA, USA

I think too that such change is "strange".
I have the same problem - I modified one if and got Acc again ...

But I think, that description of problem hould change too -> I can't read any word about them. If I read "you must reach 23", it means for me +23, not -23

Best regards
DM
If you really want to get Accepted, try to think about possible, and after that - about impossible ... and you'll get, what you want ....
Born from ashes - restarting counter of problems (800+ solved problems)
Dominik Michniewski
Guru

Posts: 828
Joined: Wed May 29, 2002 4:11 pm
Location: Wroclaw, Poland

### WA after rejudgement

I got WA after the latest rejudgement in Jan,'06.
I did it only about a month ago. So my program takes care of both 23 and -23, I believe. Can somebody post some tricky I/O?
mamun
A great helper

Posts: 286
Joined: Mon Oct 03, 2005 1:54 pm

my program takes care of both 23 and -23

You know the fun? After I stopped my program to take care of -23, I got it accepted
mamun
A great helper

Posts: 286
Joined: Mon Oct 03, 2005 1:54 pm

Sorry, I got WA all the time after rejudge.
I have passed all the input/ouput on the board.
Could someone give me some tricky input/output?
Thx
windows2k
Experienced poster

Posts: 136
Joined: Sat Apr 05, 2003 3:29 pm
Location: Taiwan

Here are some I/O
Input
Code: Select all
`42 8 2 32 37 10 43 21 46 5 44 2 27 30 29 10 20 20 2 36 28 3 34 42 222 6 6 5 3734 3 31 18 1225 46 28 13 212 4 19 2 501 12 2 1 4948 48 42 2 111 2 43 26 330 0 0 0 0`

Output
Code: Select all
`PossiblePossibleImpossibleImpossibleImpossibleImpossibleImpossibleImpossibleImpossibleImpossibleImpossibleImpossible`
mamun
A great helper

Posts: 286
Joined: Mon Oct 03, 2005 1:54 pm

mamun wrote:Here are some I/O

Thanks. In all that rewriting and resubmitting each time the problem was rejudged I made a silly mistake and your I/O helped me to find it. Now (finally) everything seems OK, the test data used by the judge is correct, and I have AC
misof
A great helper

Posts: 430
Joined: Wed Jun 09, 2004 1:31 pm

Miaof, can you explain why you think that the test data used by the judge is correct? I still have no idea why we care about -23.
Let's hope Yury doesn't notice that I'm solving problems again.

Abednego
A great helper

Posts: 281
Joined: Tue Sep 10, 2002 5:14 am
Location: Mountain View, CA, USA

Abednego wrote:Miaof, can you explain why you think that the test data used by the judge is correct? I still have no idea why we care about -23.

We don't. My solution that's currently AC only checks whether 23 can be achieved.

Previously, the judge used a wrong set where you had to check also whether -23 can be achieved. It looks that this bug has been fixed.
misof
A great helper

Posts: 430
Joined: Wed Jun 09, 2004 1:31 pm

PreviousNext