ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1018. Binary Apple Tree

Nazar Revutsky How Q may be equal to N ? [7] // Problem 1018. Binary Apple Tree 15 Apr 2001 01:49
What I must show if Q=1?
What I must show if Q=N???
I think that Q<N!!!
Please help.
Krzysztof Kapuscik Re: How Q may be equal to N ? [6] // Problem 1018. Binary Apple Tree 15 Apr 2001 20:32
> 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).
Pavel Aksonov Correctness of your solution [5] // Problem 1018. Binary Apple Tree 16 Apr 2001 17:40
> 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?
Nazar Revutsky My solution [3] // Problem 1018. Binary Apple Tree 16 Apr 2001 21:18
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
> 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.
Krzysztof Kapuscik Re: Correctness of your solution // Problem 1018. Binary Apple Tree 20 Apr 2001 18:34
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