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

Обсуждение задачи 1876. Утро сороконожки

Understanding the solution
Послано MARAZ MIA 22 фев 2020 03:06
After so many calculation and math I have solved the problem.....
Here we can have two worst cases...

Case 1:
having all the right shoes first.so here needed time is 2*b and we have now all the left shoes remaining...so total time is 2*b+40...

Case 2:
we may have 39 right shoes so time needed here is (39*2=78)...then we have only one right foot left but we may encounter all the left shoes and here needed time is 40+2*(a-40)....> 40 for the first 40 shoes and 2*(a-40) is for the remaining shoes as they needed to be thrown away...then we have the only one right foot left and it need 1 second...
so total time = 78+40+2*(a-40)+1 = 119+2*a-80 = 2*a-39

ans=max(Case 1,Case 2)


Edited by author 22.02.2020 03:07
Re: Understanding the solution
Послано Dibyajyoti Mondal 26 сен 2020 20:35
But it's given that both a,b>=40.....so how 39 right shoes can be there?
Re: Understanding the solution
Послано [MAI] do_v_5_strok 11 янв 2021 22:52
mistake in case 2: 119+2*a-80 = 2*a+39
everything else is correct

Edited by author 11.01.2021 22:56