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

Обсуждение задачи 1200. Рога и копыта

My solution is O(K). Does exist better solution?
Послано Vlad Veselov 8 май 2004 15:50
Re: My solution is O(K). Does exist better solution?
Послано Sandro 27 май 2004 00:08
I have O(K) solution too, but I suspect that there is a simple solution O(1).
Re: My solution is O(K). Does exist better solution?
Послано anus (USU) 8 июл 2006 20:07
I have O(1) solution. Simply draw conditions in Cartesian coordinates with axis horns and hoofs.
Re: My solution is O(K). Does exist better solution?
Послано wangyin 14 авг 2006 15:01
Mine is O(min(a,b) div 2)
0.015s
Re: My solution is O(K). Does exist better solution?
Послано Piratek-(akaDK) 19 янв 2008 02:52
 We must solve some equipments
{Ax + By - x * x - y * y = Max , x + y <= k} where A , B , K we know. We simplify first equipment of that system

x * (A - x) + y * (B - y) = Max {1}

Our First Problem is to find x + y? Let's do it!
If we decrease x(or y) x = x - 1.We will get

(x - 1) * (A - x + 1) + y * (B - Y) =
Ax - x^2 + x - A + x - 1 + By - y^2. Let's compare it with {1}
<---> Ax - x^2 + By - Y^2
The same part is consist of all Ax - x^2 + By - Y^2.
so if we subtract it we'll get
2 *x - 1 - A. So it x > (A + 1) / 2 we can decrease x to increase our profit. It's equal to y if y > (B + 1) / 2 we can decrease y.
Re: My solution is O(K). Does exist better solution?
Послано Vedernikoff Sergey 5 июн 2008 01:07
From trivial economic theory (micro 0) we should equate marginal benefits - that's all!
Re: My solution is O(K). Does exist better solution?
Послано Denis Koshman 28 июл 2008 03:49
I just test 5x5 vicinities of 0;0, 0;k, k;0, a/2;b/2, a/2;0, 0;b/2, a/4-b/4+k/2;b/4-a/4+k/2.