You are not logged in. Please login at www.codechef.com to post your questions!

×

WA in GALACTIK Please Help!

Checked all previous links in the forum for this question... but unable to debug... I'm doing dfs to find min tax val node in each component(val>=0) and then using it to construct optimum edges. WA Code

asked 01 May '18, 17:47

dushyant7917's gravatar image

5★dushyant7917
716
accept rate: 0%


Editorial link https://discuss.codechef.com/questions/18004/galactik-editorial
You need to find the vertex which has lowest cost of all vertexes. It will be in some component so we should connect all other components to that component to achieve minimum cost. Keep the sum total of all min tax val node of each component.
Total cost= minVal*(K-1) + (sum- minVal)

link

answered 01 May '18, 20:06

vbt_95's gravatar image

4★vbt_95
4406
accept rate: 27%

Thanks for help :) I missed this part... "We should connect all other components to that component to achieve minimum cost!"

(01 May '18, 21:51) dushyant79175★
toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×2,736
×1,236
×1,070
×733
×9

question asked: 01 May '18, 17:47

question was seen: 135 times

last updated: 01 May '18, 21:51