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

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

Fyodor Menshikov Simple problem or weak tests? [18] // Задача 1424. Маршрутка 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
Alexander Kouprin Re: Simple problem or weak tests? [17] // Задача 1424. Маршрутка 15 май 2007 03:57
I used greedy algo, pascal, 0.265sec works, O(2*M*K) too.
svr Re: Simple problem or weak tests? [16] // Задача 1424. Маршрутка 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....
Dmitry 'Diman_YES' Kovalioff O(M*K) solution is ok (+) [3] // Задача 1424. Маршрутка 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.
Fyodor Menshikov About server speed [1] // Задача 1424. Маршрутка 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...
Dmitry 'Diman_YES' Kovalioff I think one can find the performance rate himself (+) // Задача 1424. Маршрутка 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.
svr Re: O(M*K) solution is ok (+) // Задача 1424. Маршрутка 16 май 2007 22:37
Is Activity Selection problem standard internet term?
Fyodor Menshikov Re: Simple problem or weak tests? [2] // Задача 1424. Маршрутка 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
Alexander Kouprin Re: Simple problem or weak tests? [1] // Задача 1424. Маршрутка 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.
Fyodor Menshikov Re: Simple problem or weak tests? // Задача 1424. Маршрутка 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.
SPIRiT Re: Simple problem or weak tests? [8] // Задача 1424. Маршрутка 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...
svr Re: Simple problem or weak tests? // Задача 1424. Маршрутка 27 июн 2007 14:08
Thank for "lecture hall assignment" brand!
SPIRiT Re: Simple problem or weak tests? [6] // Задача 1424. Маршрутка 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?
svr Re: Simple problem or weak tests? [5] // Задача 1424. Маршрутка 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
SPIRiT Re: Simple problem or weak tests? // Задача 1424. Маршрутка 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
SPIRiT Re: Simple problem or weak tests? [3] // Задача 1424. Маршрутка 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
marius dumitran Re: Simple problem or weak tests? [2] // Задача 1424. Маршрутка 29 окт 2007 12:50
my algo is
O(N + K *log(M))  -> AC in 0.1
Denis Koshman Re: Simple problem or weak tests? [1] // Задача 1424. Маршрутка 20 авг 2008 12:02
Mine too :)
hoan Re: Simple problem or weak tests? // Задача 1424. Маршрутка 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!!!