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

Обсуждение задачи 1211. Круговая порука

Correct idea is HERE
Послано Vlad Veselov 6 июн 2003 19:04
Use two arrays:
Ans,Status : Array [1 .. 25000] Of Word;
Ans is answers of children, Status is current status of every of them.
First Status = DUP(0), and then
 Status[i] = 0 - if child i have unknown status
             1 - if child's answer is "Me!!!"
             k - if we marked him(or her) on step k(k >= 2)
In every iteration we searching for child with unknown status(p).
If his(or her)answer is "Me" we making his(or her) status equal to
1, else we mark him(or her) with k and going to check child Ans[p].
If we meet status=k in our checking then cycle is found. Else we
continue this process until we can find child with status = 0.
Don't forget calculate children with status = 1.
My solution on Pascal got AC with 0.62 sec., 127K.
P.S. Sorry for bad English.
I just use 0.203s
Послано hello 15 май 2004 23:08
After system upgrade it works 0.234 sec.
Послано Vlad Veselov 16 май 2004 19:35
Re: Correct idea is HERE
Послано Фоминых Федор 25 июл 2005 14:02
/*AC*/
double time = 0.14;
long memory = 349; //КБ
return;

I am not use your idea!!!

No optimization!!!

Edited by author 25.07.2005 14:03

Edited by author 25.07.2005 14:04

Edited by author 25.07.2005 14:05
My more faste and memory LOW!!
Послано Tolstobrov_Anatoliy[Ivanovo SPU] 29 июл 2005 02:29

885512
02:26:18
29 июл 2005
Tolstobrov_Anatoliy[Ivanovo SPU]
1211
Pascal
Accepted

0.062
223 КБ


Who can better????
Oh foget!!
Послано Tolstobrov_Anatoliy[Ivanovo SPU] 29 июл 2005 02:36

I USE

const coll=25000;
var
m:array[0..coll]of word;
z,b:array[0..coll]of boolean;
t,i,k,j,n:word;
kk,gg,bb:boolean;