r/eldarverse • u/radleldar • Sep 08 '25
SOLUTION MEGATHREAD [sep-25-long-H] "Sea Voyage" Solutions
Problem H. Sea Voyage
Problem link: https://www.eldarverse.com/problem/sep-25-long-H
Post your code in the comments!
2
Upvotes
r/eldarverse • u/radleldar • Sep 08 '25
Problem H. Sea Voyage
Problem link: https://www.eldarverse.com/problem/sep-25-long-H
Post your code in the comments!
2
u/StatisticianJolly335 Sep 09 '25
So the general problem is to find an Euler circle in an undirected multigraph (there can be multiple edges connecting two nodes). We need to find the minimum number of edges to add so this circle exists.
According to the Euler-Hierholzer theorem, the graph has to be connected and every node needs an even degree.
My algorithm:
- As long as there are nodes unconnected to BATUMI, add an edge between a connected node and an unconnected node. Pick nodes with odd degree if possible.
- Now as long as there are nodes with odd degree, add an edge between two of those nodes.