[Graphs?] Struggling figuring out the algorithm

Task: create the most city road repair plan with the least steps. Can only repair up to 2 roads at a time. If road disconnects any of the places it cannot be repaired. Input in u3.txt side result on the other.
No description
16 Replies
MartynasXS
MartynasXSOP2mo ago
input first row is city; road counts then names for cities and then roads Either I've forgotten how dfs and bfs algos work or this doesnt use either? @ἔρως
ἔρως
ἔρως2mo ago
this is completely outside my knowledge, but i would say this is something related to graph theory?
MartynasXS
MartynasXSOP2mo ago
Yeah
ἔρως
ἔρως2mo ago
i know nothing about anything related to this, and i can't tie my shoes
MartynasXS
MartynasXSOP2mo ago
But like Im not sure if this is supposed to be solved like graph theory problems because I think this is highschool level programming competition task I only learns of graphs in second year of uni 😭
ἔρως
ἔρως2mo ago
i honestly have no idea, since ive never done anything like this
MartynasXS
MartynasXSOP2mo ago
All good, I've done this several times and Im still clueless whats going on lol XD Man I got it somewhat working
MartynasXS
MartynasXSOP2mo ago
No description
MartynasXS
MartynasXSOP2mo ago
No description
MartynasXS
MartynasXSOP2mo ago
solution is technically correct but the result doesnt match hmmm I think if i test If the road is repaired already and choose to go down the one that wasnt it should make it as to where my order matches the example data too
MartynasXS
MartynasXSOP2mo ago
No description
MartynasXS
MartynasXSOP2mo ago
No description
MartynasXS
MartynasXSOP2mo ago
@ἔρως Now this you should be able to chime in on 😄 Do these unit tests make sense? unrepairedcount should be unrepaired roads tho basically checking if its done in expected amount of turns and if the unrepaired roads are the same
ἔρως
ἔρως2mo ago
does it work?
MartynasXS
MartynasXSOP2mo ago
The test? ye they work I didnt change the functionality cuz theres a clause saying pick first correct solution so hoping it counts
ἔρως
ἔρως2mo ago
if it works, it should count

Did you find this page helpful?