10421 - Critical Wave

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

Moderator: Board moderators

ChristopherH
New poster
Posts: 31
Joined: Sun Feb 23, 2003 9:18 pm
Location: Waterloo, Ontario, Canada

Post by ChristopherH » Fri May 16, 2003 2:43 pm

DM, I think there is some confusion in your code with the use of 'd', 'next', and len[2]. len[0] and len[1] don't seem to represent consistently either an 'upper' or 'lower' path, instead they depend on the value of .next, which may be rewritten on another pass. You may end up writing two different kinds of paths involving a point in len[0] (or len[1]), losing one of the values.

I would strongly recommend removing 'next' and 'd' altogether. Instead, use len[0] and len[1] to represent 'max wave length terminating in this point as a lower point' and 'max wave length terminating in this point as an upper point'. (note that then you'll need to update p[j].len[1] on the basis of p.len[0], ie upper and lower points alternate).

When I make this modification to your program, it appears to be correct to me.

Regards,
Christopher

Dominik Michniewski
Guru
Posts: 834
Joined: Wed May 29, 2002 4:11 pm
Location: Wroclaw, Poland
Contact:

Post by Dominik Michniewski » Fri May 16, 2003 4:01 pm

Thanks Christopher, I try to do it in weekend :)

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)

Red Scorpion
Experienced poster
Posts: 192
Joined: Sat Nov 30, 2002 5:14 am

Post by Red Scorpion » Sat May 17, 2003 3:59 am

Hahaha... :lol: :lol: :lol: :lol:
Finally I got AC. Thanks Little John.
The only mistake is my code give 1, when the input = 0.

Huge Thanks,
RS :o

Post Reply

Return to “Volume 104 (10400-10499)”