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

Обсуждение задачи 1798. Огненный круг. Версия 2

A HINT
Послано Jorjia 18 янв 2018 15:49
Solution is a sum( [ sqrt(2*i*R - i^2) ], i = 1,2,...,R), where [ x ] - round to up.

But, I always GOT TL on 17 test).
Re: A HINT
Послано Shen Yang 13 апр 2018 13:26
if we notice  f(i)==sqrt(2*i*R-i*i);  and f(i+1)-f(i) always >=sqrt(R)

we can change to count howmany i satisfy c==sqrt(2*i*R-i*i)  then answer+=ways*c

then this problem will be solved in O(sqrt(R))

thank you for your hint
Re: A HINT
Послано Shen Yang 13 апр 2018 14:08
my fault but increment of f(i) seems to be monotonic decreasing and increment <=sqrt(2*r)

so we can binary search and divide them to sqrt(2*r)  segment with same increment and add each segment using sum of arithmetic series
Re: A HINT
Послано Shen Yang 13 апр 2018 14:08
my fault but increment of f(i) seems to be monotonic decreasing and increment <=sqrt(2*r)

so we can binary search and divide them to sqrt(2*r)  segment with same increment and add each segment using sum of arithmetic series