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

Обсуждение задачи 1803. Винтовки белочехов

Solving
Послано Vasiliy 31 окт 2010 16:56
Could you please give me a hint?
Do we need to generate a fibonachi digits in any way or there is a better solution?
Re: Solving
Послано quick(YarSU) 31 окт 2010 19:37
same question.
I wrote the solution:
1) generate fib one by one and sum digits.
2) very optimize actions and no copy array of digits
3) stable sort or count sort

==>

it works on test "2 50000" about 4 - 5 second.
TL 12
How did you avoid TL?
Re: Solving
Послано Moonstone [Samara SAU] 1 ноя 2010 09:56
1. Generate all sums of digits for numbers from 0 to k^p-1 (the best p is 6 for my solution)
2. Replace k with k^p
3. Run stupid solution but add precalculated numbers to sum
4. ???????
5. PROFIT
Re: Solving
Послано quick(YarSU) 1 ноя 2010 12:41
accepted...
Re: Solving
Послано 72VanVector[SevNTU] 4 ноя 2010 20:50
How can i generate Fibonchi num 50000? it is very big!
Re: Solving
Послано Moonstone [Samara SAU] 4 ноя 2010 22:48
Use long arithmetics.
Re: Solving
Послано 72VanVector[SevNTU] 5 ноя 2010 01:57
So in the worst case i must calculate the 50000 Fibonachi numbers, writing them using long arithmetic, at the same time calculating the number of banknotes to pay for them, writing this calculations in separate array. Then i must sort this array and print the bounded numbers of sorted elements from begin to the end.


Is this method ok?
Re: Solving
Послано Moonstone [Samara SAU] 5 ноя 2010 13:57
This method gets TLE, but it may be improved (look at my previous messages).
Re: Solving
Послано 72VanVector[SevNTU] 5 ноя 2010 14:52
Thx... Will try to calculate the number of banknotes using precounted values...
Re: Solving
Послано Vasiliy 8 ноя 2010 01:26
Guys, could you please send me your code for investigation?
kobchik83@list.ru
Re: Solving
Послано elkasimi 4 дек 2010 21:47
THANKS A LOT FOR YOUR HINT !!
Re: Solving
Послано elkasimi 4 дек 2010 21:51
THANKS A LOT FOR YOUR HINT !!
Re: Solving
Послано elkasimi 4 дек 2010 21:53


Edited by author 04.12.2010 21:54