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
yiuyuho
A great helper
Posts: 325 Joined: Thu Feb 21, 2002 2:00 am
Location: United States
Contact:
Post
by yiuyuho » Thu Jun 07, 2007 8:09 am
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
Post
by rujialiu » Thu Jun 07, 2007 9:03 am
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 » Thu Jun 07, 2007 4:37 pm
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 » Thu Jun 07, 2007 5:57 pm
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 » Thu Jun 07, 2007 7:16 pm
How can it be such a big difference though?
jah
New poster
Posts: 38 Joined: Wed Apr 20, 2005 12:23 am
Post
by jah » Mon Jul 09, 2007 10:04 pm
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 » Wed Aug 15, 2007 11:49 am
Any hint to solve this problem ?
jah
New poster
Posts: 38 Joined: Wed Apr 20, 2005 12:23 am
Post
by jah » Wed Aug 15, 2007 5:04 pm
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
Post
by baodog » Wed Aug 15, 2007 11:22 pm
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 » Sat Aug 18, 2007 1:33 pm
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.