10344 - 23 out of 5

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

Moderator: Board moderators

misof
A great helper
Posts: 430
Joined: Wed Jun 09, 2004 1:31 pm

Post by misof »

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 :(
TISARKER
Learning poster
Posts: 88
Joined: Tue Oct 12, 2004 6:45 pm
Location: Bangladesh
Contact:

Post by TISARKER »

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
mf
Guru
Posts: 1244
Joined: Mon Feb 28, 2005 4:51 am
Location: Zürich, Switzerland
Contact:

Post by mf »

50^5 is only 312500000, which quite well fits in an 'int' (32-bit, of course)
TISARKER
Learning poster
Posts: 88
Joined: Tue Oct 12, 2004 6:45 pm
Location: Bangladesh
Contact:

Post by TISARKER »

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. :P
I only wanted to say that use long type variable(32 bit) instead of int type variable (16 bit). :D
Thnk for Advance.
Mr. Arithmetic logic Unit
misof
A great helper
Posts: 430
Joined: Wed Jun 09, 2004 1:31 pm

Post by misof »

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. :P
I only wanted to say that use long type variable(32 bit) instead of int type variable (16 bit). :D
Thnk for Advance.
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/ )
TISARKER
Learning poster
Posts: 88
Joined: Tue Oct 12, 2004 6:45 pm
Location: Bangladesh
Contact:

Post by TISARKER »

mf, A lot of thanks.
Mr. Arithmetic logic Unit
Abednego
A great helper
Posts: 281
Joined: Tue Sep 10, 2002 5:14 am
Location: Mountain View, CA, USA
Contact:

Post by Abednego »

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?
If only I had as much free time as I did in college...
Dominik Michniewski
Guru
Posts: 834
Joined: Wed May 29, 2002 4:11 pm
Location: Wroclaw, Poland
Contact:

Post by Dominik Michniewski »

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)
mamun
A great helper
Posts: 286
Joined: Mon Oct 03, 2005 1:54 pm
Location: Bangladesh
Contact:

WA after rejudgement

Post by mamun »

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
Location: Bangladesh
Contact:

Post by mamun »

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 :P
windows2k
Experienced poster
Posts: 136
Joined: Sat Apr 05, 2003 3:29 pm
Location: Taiwan

Post by windows2k »

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 :D
mamun
A great helper
Posts: 286
Joined: Mon Oct 03, 2005 1:54 pm
Location: Bangladesh
Contact:

Post by mamun »

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 2
22 6 6 5 37
34 3 31 18 12
25 46 28 13 2
12 4 19 2 50
1 12 2 1 49
48 48 42 2 11
1 2 43 26 33
0 0 0 0 0
Output

Code: Select all

Possible
Possible
Impossible
Impossible
Impossible
Impossible
Impossible
Impossible
Impossible
Impossible
Impossible
Impossible
misof
A great helper
Posts: 430
Joined: Wed Jun 09, 2004 1:31 pm

Post by misof »

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 :D
Abednego
A great helper
Posts: 281
Joined: Tue Sep 10, 2002 5:14 am
Location: Mountain View, CA, USA
Contact:

Post by Abednego »

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.
If only I had as much free time as I did in college...
misof
A great helper
Posts: 430
Joined: Wed Jun 09, 2004 1:31 pm

Post by misof »

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.
Post Reply

Return to “Volume 103 (10300-10399)”