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

Общий форум

is my algorithm right? problem 1022
Послано Ivan Kokan 24 авг 2005 01:19
 i'm using method of giving points to each person, so that every child has more points than his father. i'm doing that with bfs:

if points[child] <= points[parent]
points[child] = points[parent] + 1;
bfs (child);

i think method is right.

i know about topological sort, but i'm interested is my idea ok. (my code fails on test case #5).
Re: is my algorithm right? problem 1022
Послано ACM.Krupko_Victor[Ivanovo SPU] 24 авг 2005 02:03
Try my algorithm:

You find the person at which there are no parents. Remove him. You delete him.

And all this in a cycle.
Re: is my algorithm right? problem 1022
Послано Ivan Kokan 24 авг 2005 02:48
 i know about that. that's topological sort. i'm only trying to figure out if my algorithm is correct. that's all.
:) :(
Послано ACM.Krupko_Victor[Ivanovo SPU] 24 авг 2005 02:53
If at you wa5 as your algorithm can be correct.:)
I simply wanted to help.
Re: :) :(
Послано Ivan Kokan 25 авг 2005 20:13
 i don't understand your post.

 also, i haven't got any comment about my problem yet.