What wrong with dancing pairs?

Back to Problem Solutions forum

Moff     2015-02-22 07:08:12
User avatar

While solving Dancing Pairs i've implemmented classic algorithm for such problem, but the answer differs.

Rodion (admin)     2015-02-22 11:45:43
User avatar

Hi, thanks for your message.

It may happen that my own solution is wrong - I'll try to check your code and hope to come back soon!

Well, I'm having some troubles with running your solution. At first it appeared I need networkx and setuptools, after installing which I suddenly found out that ford_fulkerson is not defined :)

Could you please tell, what is your answer for some basic case, like this:

3
1: 4
2: 4
3: 4 5 6

UPD: I suddenly think my own solution may be wrong on such case. I'll go and test it!

UPD2: Could you please retry your submission when you have a time. I think I found in the checkre code one line which should be removed. :(

Moff     2015-02-22 18:55:04
User avatar

No. Changes does not affected.

I've added imports for networkx and ford_fulkerson.

My solution for:

3
1: 4
2: 4
3: 4 5 6

is

2
Rodion (admin)     2015-02-22 20:48:46
User avatar

Thank you! So there should be something wrong with my implementation. I'll mark the problem as suspectededly incorrect and will try to study what could be the trouble more thoroughly.

I'm very sorry for this inconvenience :(

Rodion (admin)     2015-02-23 08:49:04
User avatar

UPD: It appeared that my yesterday's "hotfix" was insufficient - I still was building directed graph improperly and missed the warnings.

Now I hope it is working correctly (please, check - he-he) so thanks once more for your patience and help!

Moff     2015-02-23 11:15:00
User avatar

I've solved it without changing my implementation. Thanks for so fast fix!

nicolas_patrois     2015-02-23 14:36:56
User avatar

The pseudo code that I found somewhere is also successful.

Please login and solve 5 problems to be able to post at forum