10344 - 23 Out of 5

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

Moderator: Board moderators

Postby misof » Fri Dec 23, 2005 12:58 am

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

Postby TISARKER » Fri Dec 23, 2005 4:38 am

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

Postby mf » Fri Dec 23, 2005 4:54 am

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

Postby TISARKER » Fri Dec 23, 2005 5:33 am

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

Postby misof » Fri Dec 23, 2005 12:01 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. :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/ )
misof
A great helper
 
Posts: 430
Joined: Wed Jun 09, 2004 1:31 pm

Postby TISARKER » Fri Dec 23, 2005 4:27 pm

mf, A lot of thanks.
Mr. Arithmetic logic Unit
TISARKER
Learning poster
 
Posts: 88
Joined: Tue Oct 12, 2004 6:45 pm
Location: Bangladesh

Postby Abednego » Sat Jan 07, 2006 11:29 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.
User avatar
Abednego
A great helper
 
Posts: 281
Joined: Tue Sep 10, 2002 5:14 am
Location: Mountain View, CA, USA

Postby Dominik Michniewski » Mon Jan 09, 2006 1:24 pm

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

Postby mamun » Tue Jan 10, 2006 1:53 pm

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

Postby mamun » Wed Jan 11, 2006 3:11 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 :P
mamun
A great helper
 
Posts: 286
Joined: Mon Oct 03, 2005 1:54 pm
Location: Bangladesh

Postby windows2k » Thu Jan 26, 2006 5:13 am

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

Postby mamun » Thu Jan 26, 2006 6:19 pm

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

Postby misof » Mon Feb 06, 2006 3:09 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 :D
misof
A great helper
 
Posts: 430
Joined: Wed Jun 09, 2004 1:31 pm

Postby Abednego » Mon Feb 06, 2006 3:38 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.
User avatar
Abednego
A great helper
 
Posts: 281
Joined: Tue Sep 10, 2002 5:14 am
Location: Mountain View, CA, USA

Postby misof » Mon Feb 06, 2006 5:12 pm

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

Return to Volume CIII

Who is online

Users browsing this forum: No registered users and 1 guest