|
|
вернуться в форумno tricks, just an Eulerian cycle on the negative edges... on the negative edges? Are there any differences with on the unnegative edags? you have the adjacency(?) matrix. Negative means that you change 1 with 0 and 0 with 1. Then, on this new graph you make an Eulerian cycle. I can post my source if really need I'm sorry I can't understand you. What does "change 1 with 0 and 0 with 1." mean? The problem gives you that binary matrix with a[i][j] = 1 if i and j are connected. Reversing 1 with 0 and vice-versa means that if i and j are connected than you unconnect them (i.e. a[i][j] = 0) and if they are not connected, a[i][j] = 0, you connect them, a[i][j] = 1. You do this because the spaceship can build cannals that don't exist, so it must walk only between unconnected nodes. Covering all cannals that do not exist and return to the initial node is a cycle that covers all these unconnected edges once, exactly like an Eulerian cycle. How did you pass the first tests if you didn't understand these? With all respect. Thank you! I mistook you at that time...Very sorry.. But I think I use the same method as you..Maybe there is something wrong with my code. |
|
|