11209 - Be Together Again and Forever

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

Moderator: Board moderators

Post Reply
yiuyuho
A great helper
Posts: 325
Joined: Thu Feb 21, 2002 2:00 am
Location: United States
Contact:

11209 - Be Together Again and Forever

Post by yiuyuho »

I think I get this problem during contest and I submitted the same algorithm to the OJ and get TLE....did the data got enhanced?

What's happening?
rujialiu
New poster
Posts: 37
Joined: Mon Mar 05, 2007 2:42 am

Re: 11209 Be Together Again and Forever

Post by rujialiu »

yiuyuho wrote:I think I get this problem during contest and I submitted the same algorithm to the OJ and get TLE....did the data got enhanced?

What's happening?
I wanted to enhance the data but finally i did not :) What is the runtime during the contest?
:-)
yiuyuho
A great helper
Posts: 325
Joined: Thu Feb 21, 2002 2:00 am
Location: United States
Contact:

Post by yiuyuho »

736 yiuyuho Be Together Again and Forever Solved C++ 0.850 2007-06-03 08:28:28

The time during contest was < 1sec...there must have been an error...lol!
rujialiu
New poster
Posts: 37
Joined: Mon Mar 05, 2007 2:42 am

Post by rujialiu »

yiuyuho wrote:736 yiuyuho Be Together Again and Forever Solved C++ 0.850 2007-06-03 08:28:28

The time during contest was < 1sec...there must have been an error...lol!
maybe that's because the old server (on which you got TLE) uses a older version of g++?
I'm not sure.
:-)
yiuyuho
A great helper
Posts: 325
Joined: Thu Feb 21, 2002 2:00 am
Location: United States
Contact:

Post by yiuyuho »

How can it be such a big difference though?
jah
New poster
Posts: 38
Joined: Wed Apr 20, 2005 12:23 am

Implementation ideas

Post by jah »

Hi I would really appreciate some implementation ideas for this problem.

[EDIT] Got it. Fairly simple heuristic.

Thanks
menghiot
New poster
Posts: 4
Joined: Fri Sep 23, 2005 6:57 am

Post by menghiot »

Any hint to solve this problem ?
jah
New poster
Posts: 38
Joined: Wed Apr 20, 2005 12:23 am

Post by jah »

The idea is to generate all the paths from Jiajia to WinD incrementally, in order of length, and stop when you find one which has a node equidistant from both.
baodog
Experienced poster
Posts: 202
Joined: Wed Jul 04, 2007 6:53 am

IDS

Post by baodog »

I try simple Iterative DFS .. mark nodes reached
by one person at some depth, then search to same depth for the other
person ... (using adjacency list representation)...
But it's not fast enough. Is there anyway to optimize it?
Thanks.
jah
New poster
Posts: 38
Joined: Wed Apr 20, 2005 12:23 am

Post by jah »

Hi baodog,

You can improve your method by sorting the nodes in the adjacency list. My dfs only computes a single path (not two simultaneously) and looks for the existance of a midpoint in that path.
Post Reply

Return to “Volume 112 (11200-11299)”