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

Обсуждение задачи 1828. Приближение прогрессией

why wa 24? i used nested ternary search. what's the idea to solve the problem?
Послано muhammad 21 мар 2011 17:01
i used nested ternary search on a and d but wa ( 24 when eps=1e-7 && 11 when eps<1e-7)
i figured the function should be like that-
f(a,d)=c1a^2+c2a+c3ad+c4d^2+c5d+c6
where c1=n && c4=n*(n-1)*(2*n-1)/6.0
here for n>1 the coefficient of a^2 and d^2 is always positive. so there should be only one(since quadratic) and low peak. so i thought ternary search would do. but why diff wa on diff value of eps. again, i found (by checking for tle) that there are high peaks as well. how can it be? perhaps, i am wrong right on the idea itself. please, guys help me find my bug.
and, please tell me at least the method of solving. is it ternary search or some direct math formula or something else i am missing. if ternary search please tell me whether there is indeed high peaks and how did u deal with them...

thanks in advance.

Edited by author 21.03.2011 17:01
Re: why wa 24? i used nested ternary search. what's the idea to solve the problem?
Послано Vedernikoff 'Goryinyich' Sergey (HSE: АОП) 21 мар 2011 17:35
There is closed-form solution to the problem. Read some basic econometrics textbooks, "simple linear regression" section therein.
Re: why wa 24? i used nested ternary search. what's the idea to solve the problem?
Послано muhammad 21 мар 2011 18:21
thanks very much
got ac. so simple :)