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

Обсуждение задачи 1424. Маршрутка

Показать все сообщения Спрятать все сообщения

Simple problem or weak tests? Fyodor Menshikov 15 май 2007 02:19
My solution should use 2 * M * K indexations of linear array in the worst case (100 000 000 for max M and K) but works about 0.5s, twice less than time limit, and it is Java!

Does it mean that so simple algorithm is enough or that tests are weak?

Edited by author 15.05.2007 02:27
Re: Simple problem or weak tests? Alexander Kouprin 15 май 2007 03:57
I used greedy algo, pascal, 0.265sec works, O(2*M*K) too.
Re: Simple problem or weak tests? svr 15 май 2007 10:47
For such strong authors request of failed solver!
Give us short clarification of this great optimization
problem!
What is more simple prototipe of it?
What class of the problem? Graphs?DP? May be....
O(M*K) solution is ok (+) Dmitry 'Diman_YES' Kovalioff 15 май 2007 11:54
Timus Online Judge server is fast enough to perform more than 100000000 operations per second.

The problem is based on the Activity Selection problem.
About server speed Fyodor Menshikov 15 май 2007 12:08
Dmitry 'Diman_YES' Kovalioff писал(a) 15 мая 2007 11:54
Timus Online Judge server is fast enough to perform more than 100000000 operations per second.

The truth of this statement depends on operation kind. Recently I solved problem in which 50 000 000 operations * and % on 64-bit integers worked 2s.

Dmitry, do you know more precise numbers, how many operations of each kind the server can execute per second? For example linear array indexations - 180 bln, long multiplication - 100 bln and so on...
I think one can find the performance rate himself (+) Dmitry 'Diman_YES' Kovalioff 15 май 2007 16:53
Just write a kind of performance mark program, submit it and you will get exactly what you want.

Then you may post the results here and everyone will appreciate your work.
Re: O(M*K) solution is ok (+) svr 16 май 2007 22:37
Is Activity Selection problem standard internet term?
Re: Simple problem or weak tests? Fyodor Menshikov 15 май 2007 12:01
svr писал(a) 15 мая 2007 10:47
What is more simple prototipe of it?

I don't know.
svr писал(a) 15 мая 2007 10:47
What class of the problem? Graphs?DP? May be....

I'd said simulation. And I think Alexander Kouprin's definition "greedy" is right.

The problem gets simpler if you change its model. You can allow driver to debus any boarded passenger at any stop < F[i] refunding the passenger all her money P. The driver in this case would get the same amound of money as if he would not board that debussed half-way passengers at all.

Edited by author 15.05.2007 14:09
Re: Simple problem or weak tests? Alexander Kouprin 15 май 2007 12:29
I'd said it's sorting problem. :)
You have segments of way: first point and last.
Your task is how to combinate maximum of segment in K lines.
This lines can be severed inside of itself and have big holes.
Re: Simple problem or weak tests? Fyodor Menshikov 15 май 2007 14:16
Alexander Kouprin писал(a) 15 мая 2007 12:29
I'd said it's sorting problem. :)

I used sorting too, but I think the main problem is to devise what to do after sorting.
Re: Simple problem or weak tests? SPIRiT 27 июн 2007 14:00
I think it's a lecture hall assignment problem. One thing is that number of lecture halls here is limited by M...
Re: Simple problem or weak tests? svr 27 июн 2007 14:08
Thank for "lecture hall assignment" brand!
Re: Simple problem or weak tests? SPIRiT 4 июл 2007 17:57
I tried to solve it running Greedy-Activity-Selector M times. But WA at test 4. What is wrong with such approach?
Re: Simple problem or weak tests? svr 29 сен 2007 14:34
Gready _Activity_Selector of course.
But with auxiliary subproblem:
Let we have a set S={[ai,bi]} intervals chosen to some
moment and according with greedy should include in S
new segment [c,d]. Can we do it without excess of M.
For, we must solve the problem of maximal overlapping
value. I used augmented red-black tree
as in Cormen but have very bad time 0.843 AC.
Intuition says that good times taken due better
ways of solving auxiliary problem.

Edited by author 29.09.2007 14:41
Re: Simple problem or weak tests? SPIRiT 3 окт 2007 21:35
Thanks, I realised that. I simply store now all stations beginnings in an array (maximum K). I initialise it with M value for each element. Now, for each request I go from start to end and check if all elements are non-zero (not including the end). If that requirement is met, I add the request to the result and decrement all checked elements
Re: Simple problem or weak tests? SPIRiT 9 окт 2007 18:55
By the way. Should we sort just time ending of the activity? In that case I get WA#4, If I sort beginnings in decreasing order in case of end equals, I get TLE #4
Re: Simple problem or weak tests? marius dumitran 29 окт 2007 12:50
my algo is
O(N + K *log(M))  -> AC in 0.1
Re: Simple problem or weak tests? Denis Koshman 20 авг 2008 12:02
Mine too :)
Re: Simple problem or weak tests? hoan 29 дек 2010 20:35
i use segment tree and got AC in 0.109.
what's the best algo?
order of my algo is O((n+m)logn + klogk).
GOOD LUCK!!!