[Community Puzzle] Electrical Grid

Hi,
I’m doing electrical grid

I pass all the IDE tests, but my submission is that 25%

I wondered if the submission tests were similar in terms of size, or if it was much bigger in number of pairs,

Thank you in advance for your answer

Hi

I built an awful solution which did pass tests 1, 3 and 4 in IDE and it times out on the 2nd one and it shows the same results for the code submission, So i guess you’re mistake is somewhere else :wink:

Good Luck

You can pass the validators with O(N²) in ruby
good luck

Hi,

I have created the code which gets the solution (at least for the test cases) but it saying my solution is not right.

In example number 2,  mi output is:

9 48
1 2 3
1 6 2
4 3 8
5 7 6
5 8 5
5 9 10
6 5 1
9 4 4
9 10 9

     So I am going from node 9 to node 4. But the solutions in the tests state that:

9 48
1 2 3
1 6 2
4 3 8
4 9 4
5 8 5
5 9 10
6 5 1
7 5 6
9 10 9

    So it says that we go real solution goes from 4 to 9. That is not possible, since 4 is only connected to 9 and 3, And 3 is not connected to anything else. So solutions should be from 9 to 4 and from 4 to 3. 

    Thus, I am guessing my solution is right but I cannot prove it. What should I do? I am new here and enjoying very much the experience!!! Sorry if this is not the right place to ask this questions.

Kind regards,

1 Like

The corresponding input is:

1 6 2
6 7 7
1 2 3
6 5 1
7 5 6
7 8 15
2 4 16
4 5 11
5 8 5
2 3 17
4 3 8
4 9 4
5 9 10
8 9 12
3 9 18
9 10 9
8 10 13

3 is connected to 2, 4 and 9. Connections are not oriented.

Thanks!!!

That worked :slight_smile:

Really appreciate your help!

Hi, I am passing all test cases (Test 2: Some Houses included),

but after submitting I getting 75% with Test 2: Some Houses failure.

Any ideas?

Hi, I read all the comments but I do not understand the expected sorting for this puzzle. I solved it, but I cannot pass the tests with an incorrect order.

Here are the paths from “1” in my solution for problem #2.

1-2
1-6-5-7
1-6-5-8
1-6-5-9-4-3
1-6-5-9-10

The two links that I struggle with is “5 7” and “9 4”, because that is what you get if you follow the path from “1”, but the program output expects them as “7 5” and “4 9”.

The statement asks you to output “the connections, as given, numerically sorted (on House1, then on House2)” which means that if the input gives you “7 5 X” (instead of “5 7 X”) then you should output “7 5”. The “numerically sorted” part means that you should output the connections in lexicographical order and only refers to the comparisons between connections (not between the two houses of a connection).

1 Like

Thanks! That solved it for all the test cases!

… but, when I submit, the validating puzzle still fails on #2, lol. Nothing I can do about this any more, I guess.

Same here, failing #2 of the validators. I wonder if it is a time out or it is the format of the output.
Can anyone provide the input for validator 2 (or similar in size)?
Thanks.

(It turned out to be the format of the output.
Thanks to the creator for the nice puzzle.)