ENG  RUSTimus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила
вернуться в форум

Обсуждение задачи 1018. Двоичная яблоня

How Q may be equal to N ?
Послано Nazar Revutsky 15 апр 2001 01:49
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 ?
Послано Krzysztof Kapuscik 15 апр 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).
Correctness of your solution
Послано Pavel Aksonov 16 апр 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?
My solution
Послано Nazar Revutsky 16 апр 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
To admins: please check correctness of author solution
Послано Pavel Aksonov 16 апр 2001 21:52
> 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 .
Послано Marat Bakirov 17 апр 2001 17:27
If you will haven't found it, I can propose my solution.
Послано Pavel Aksonov 17 апр 2001 19:33
>
Re: Correctness of your solution
Послано Krzysztof Kapuscik 20 апр 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