|
|
вернуться в форумHow Q may be equal to N ? What I must show if Q=1? What I must show if Q=N??? I think that Q<N!!! Please help. Re: How Q may be equal to N ? > What I must show if Q=1? > What I must show if Q=N??? > I think that Q<N!!! > Please help. > Yeah - I think you're right. But I think it is a mistake in problem description and my solution simply don't worry about it. And for Q=1 you must leave only one branch. My solution first build the tree and after that it cuts the less valueable nodes (it mind branches are cutted also). Correctness of your solution > Yeah - I think you're right. But I think it is a mistake in > problem description and my solution simply don't worry > about it. And for Q=1 you must leave only one branch. My > solution first build the tree and after that it cuts the > less valueable nodes (it mind branches are cutted also). Maybe I've misunderstood something: Your solution for sample input with q=1 outputs "1". But if we will cut branches <2 3>, <3 5>, <1 3> then we preserve 10 apples (and it's more than 1)!!! I don't undestand why answer "1" is right and "10" is wrong. Could you please explain? My solution My solution show 10 for sample test and q=1; but for this test my program show 60 (i thing that 70 is OK) 5 2 1 2 10 2 3 50 1 4 30 4 5 40 To admins: please check correctness of author solution > My solution show 10 for sample test and q=1; > > but for this test my program show 60 (i thing that 70 is OK) > 5 2 > 1 2 10 > 2 3 50 > 1 4 30 > 4 5 40 Yes, as seems to me, author's solution show 60 and it's OK for judge system. But right answer is really 70. I've written correct solution but I've got WA. I'm now searching for original solution to ask about it , this problem is temporary locked . If you will haven't found it, I can propose my solution. > Re: Correctness of your solution I'm so sorry. I made a mistake in previous message. The right answer is (total_apple - deleted_ apple) do in the case that there should be only one node at end and there are only one at start the number of deleted_apple = 0. I'm really sorry. If someone wants to see my code, please mail me at saveman@zeus.polsl.gliwice.pl or saveman@wp.pl |
|
|