ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Common Board

1004 Time Limmit
Posted by Ilievski Bozidar 4 Oct 2000 01:19
Anybody knows a fast algorithm for this problem???
Re: 1004 Time Limmit
Posted by Geno Roupsky 4 Oct 2000 12:18
How fast do you need?
'couse DFS is OK
Re: 1004 Time Limmit
Posted by Vasil Popovski 4 Oct 2000 15:12
> Anybody knows a fast algorithm for this problem???

What do you mean "fast" ?.
Is n^3 fast enough for you?
how to write a program with n^3?
Posted by tjq(killer of zju) 4 Oct 2000 15:49
> > Anybody knows a fast algorithm for this problem???
>
> What do you mean "fast" ?.
> Is n^3 fast enough for you?
>

I only find a algorithm based on dijkstra with N^4, so
please tell me how to do it
Re: how to write a program with n^3?
Posted by Vasil Popovski 4 Oct 2000 18:27
> > > Anybody knows a fast algorithm for this problem???
> >
> > What do you mean "fast" ?.
> > Is n^3 fast enough for you?
> >
>
> I only find a algorithm based on dijkstra with N^4, so
> please tell me how to do it

Algorithm with n^3, can be based on Floyd algorithm. I
submit this program but I've got wrong answer, so I wrote
backtrack solution for this problem, which is fast enough.
I suppose you can't use floyd's dynamic method
Posted by tjq(killer of zju) 4 Oct 2000 21:06
> > > > Anybody knows a fast algorithm for this problem???
> > >
> > > What do you mean "fast" ?.
> > > Is n^3 fast enough for you?
> > >
> >
> > I only find a algorithm based on dijkstra with N^4, so
> > please tell me how to do it
>
> Algorithm with n^3, can be based on Floyd algorithm. I
> submit this program but I've got wrong answer, so I wrote
> backtrack solution for this problem, which is fast enough.

it's only correct if it's a graph with direction, but it's
not in the problem,
Re: I suppose you can't use floyd's dynamic method
Posted by Vasil Popovski 5 Oct 2000 18:19
> > > > > Anybody knows a fast algorithm for this problem???
> > > >
> > > > What do you mean "fast" ?.
> > > > Is n^3 fast enough for you?
> > > >
> > >
> > > I only find a algorithm based on dijkstra with N^4,
so
> > > please tell me how to do it
> >
> > Algorithm with n^3, can be based on Floyd algorithm. I
> > submit this program but I've got wrong answer, so I
wrote
> > backtrack solution for this problem, which is fast
enough.
>
> it's only correct if it's a graph with direction, but
it's
> not in the problem,
>

I'm sure that this problem can be solved with MODIFIED
floyd algorithm. Undirection graph is not "big" problem.