Help me!
Posted by
Saturn 21 Jun 2004 14:58
Can't you tell me how to solve this problem?
I have used both Blossom and BFS but WA(19).
The problem is VERY difficult (+)
Blossom is O(N^4), BFS is wrong in fact - and I don't know absolutely correct and fast algo... So, my solution is just BFS-based heuristics.
I used Gabow's algorithm. It work in O(n^3)
Explain, please, or give the link (-)
Re: Explain, please, or give the link (-)
Algorithm is not easy. I can send you a PDF.
Re: Explain, please, or give the link (-)
Posted by
Saturn 22 Jun 2004 02:01
Please send me. My email is quangviet2004@yahoo.com
Thanks
Please, if it is not hard for you, send to me too. veselov@xaker.ru.
Send it to dimanyes@mail.ru, please (-)
easy tests?
Posted by
mkd 23 Jun 2004 01:43
Re: easy tests?
Gabow's algorithm also uses Berge's theorem. This theorem is basic in matching theory.
What method did you use?
Re: easy tests?
Posted by
mkd 23 Jun 2004 04:35
My algorithm goes as follows:
do
foundPath=false
for i=1 to n do
begin
if exists augumenting path from vertex i then
begin
apply found path
foundPath=true
end
end
while (foundPath)
Edited by author 23.06.2004 04:40
Re: easy tests?
But how do you check if exists augumenting path?
Re: easy tests?
Posted by
mkd 23 Jun 2004 04:44
I just use a DFS.
Re: easy tests?
A simple DFS? Or something like random search?
Can you send me your source? See e-mail in my profile.
Re: easy tests?
Posted by
Saturn 23 Jun 2004 13:40
Can you send it to me? Thanks
quangviet2004@yahoo.com
Re: easy tests?
Posted by
mkd 23 Jun 2004 19:32
I can send it to everyone who already has Accepted - otherwise it would be unfair.
But I can give you my DFS:
int FindAndApply(int v)
{
visited[v] = 1;
for (PEdge t=out[v]; t != NULL; t = t->next) {
int u = t->v;
if (u == S[v]) continue;
if (visited[u] || visited[S[u]]) continue;
visited[u] = 1;
if (S[u] == 0 || FindAndApply(S[u])) {
S[u] = v;
S[v] = u;
return 1;
}
}
return 0;
}
S[i] holds a vertex matched with vertex i.
Edited by author 23.06.2004 19:33
Re: easy tests?
You can send it to anybody now becouse it doesn't work anymore ;-) I've added several new tests. All wrong methods (BFS, DFS, random search) won't pass these tests.
If your wrong program still can get AC now, please tell me.
Do you have an access to all the tests? If so I do not think it is a fair play (-)