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

Обсуждение задачи 1827. Войны туземцев

what is test 22?
Послано tracyzhu 23 мар 2011 21:11
tle at test 22...
Re: what is test 22?
Послано Vedernikoff 'Goryinyich' Sergey (HSE: АОП) 23 мар 2011 21:22
Just some big test, probably without any 1's in the answer. To speed up your code, don't use stl structures - write your own hash.
Re: what is test 22?
Послано tracyzhu 24 мар 2011 16:10
i have written my own hash to store m internal conflict and then check all n days.but also got tle.
It is driving me mad!
Do you have some better solutions?
thx for help me.

Edited by author 24.03.2011 16:11

Edited by author 24.03.2011 16:15
Re: what is test 22?
Послано Vedernikoff 'Goryinyich' Sergey (HSE: АОП) 24 мар 2011 16:19
No, my solution is pretty straightforward - take every day and for all i from 1 to 50 check whether triple (a[n], a[i+n], i) occurs in the sequence that was read from the input. Overall complexity is O(50*n) assuming complexity of your hash is O(1)

Edited by author 24.03.2011 16:22
Re: what is test 22?
Послано tracyzhu 24 мар 2011 19:29
I want know how to hash triple(ai,bi,di)..i use a list hash[len][ai] and scan it.I think it is the reason i got tle...
Re: what is test 22?
Послано tracyzhu 25 мар 2011 10:45
still tle or wa...
Re: what is test 22?
Послано svr 26 мар 2011 13:06
AC with STL
Hashing is somthing terrible.
1)form all possible segments ;2) sort it 3) find all belongings for each given conflict;
3) apply segment union - O(n) algo(very important! classical!)