ENG  RUSTimus Online Judge
Online Judge
Online contests
About Online Judge
Frequently asked questions
Site news
Problem set
Submit solution
Judge status
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
back to board

Discussion of Problem 1876. Centipede's Morning

Understanding the solution
Posted by MARAZ MIA 22 Feb 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
Posted by Dibyajyoti Mondal 26 Sep 2020 20:35
But it's given that both a,b>=40.....so how 39 right shoes can be there?
Re: Understanding the solution
Posted by [MAI] do_v_5_strok 11 Jan 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