|
|
back to boardWA6 Please, give me some hint! Re: WA6 Posted by svr 21 Apr 2009 11:51 Standard Prim's(Greedy) algo works if we assign -d to edges in graph. Re: WA6 nothing special, just obtain a spanning tree (forest)... I think you made a confusion between verteces and parents, or something like that... try this example: 7 2 10 0000101 0000101 0001010 0010010 1100001 0011000 1100100 One of the correct answers is 16 00a000d 0000000 a0000d0 0000000 000000d 00d0000 d000d00 WA6 too I've WA6 too. But on pervious test I've got AC. I use connected components of graph and Kruskal algo for builting spanning tree. Re: WA6 Try to estimate the maximal possible answer to this problem. Re: WA6 Thanks you. This test helped me to find the reason of WA6. Re: WA6 Had a very silly WA6, and none of tests from this or neighbouring topics helped, so here's the one that i finally thought of and which helped: 5 1 1 01000 10001 00010 00101 01010 (1-2, 2-5, 5-4, 4-3, result is all zeros.) I've been sleepy and lazy and did a bad job with a tree building algo, which i made like this: --- (mark vertices 1..N as unconnected) for i:=1 to N do for j:=1 to N do if (i, j) is an existing edge and either i or j is yet unconnected to anything, then add (i, j) to a tree and mark both i and j as connected. --- So then it adds 1-2, then 2-5, then 3-4, and then it appears that both 4 and 5 are already connected to something, and 4-5 isn't included to a tree, which is a mistake. Re: WA6 My programm have wa6? and on your test give: 16 0000000 000000d 000000a 00000d0 000000d 000d000 0da0d00 Is it correct? Re: WA6 Posted by LLL 2 Oct 2016 11:07 helpful!thx |
|
|