Posts

Showing posts from May, 2022

Day5

Started with debugging one of my yesterday's code of problem no. 1671A. from codeforces. One of the major learning from the past two days' problems is that never initiate the flag boolean in the starting of the code. It can be considerably harmful. Problem 1674D. of yesterday's contest was the one I solved after this. I got the logic correctly but the implementation of the logic is getting faulty somewhere. I am getting a wrong answer in one of the test cases on the preset 2. Which apparently I am not able to see.  I have tried changing the implementation 2 times, its been 3 hours now. So without wasting any more time I'll move ahead. Not much of learning done from today's question. But okay. Bye Cheers! 

Day4

 I solved 4 questions today, 1672A. from codeforces named "Log Chopping" which was a part of a previously happened contest.  1674A. 1674B. 1674C. from code forces named "Number Transformation", "Dictionary" and "Infinite Replacement" that were a part of a Div3. contest happened live today. My first contest where I solved 3 question in time. New achievement unlocked guys. It would be really cumbersome and time consuming to explain each and every problem here, so from now on I would only explain a particular problem that I would like to add to m y favorites.  All the four problems mentioned above were not that much challenging and could be done easily. So no explanation for today. Bye. Cheers!

Day3

 I just started on my own today. I did problem 1672A. on codeforces named "Log Chopping". See, the crux of the question was that the number of steps required to bring down all the logs to length 1, let that number be k. If k is even then maomao90 wins and if k is odd then errorgorn wins. Now the main task is that, given the length of all the logs we have to find the total number of steps to bring all of them down to length 1 each.  Initially  I used the following approach, We may find the log of maximum length and then find its steps of decomposition and that will be our answer coz it will take the maximum number of steps. So if the length of the log is n and n <= 2^k  (basically logarithm of n to the base 2) then k will be the number of steps to decompose that particular log. Implemented this to get wrong answer on the given test case. And immediately I caught the error. So basically for a log of length n the number of steps will not be counted using the logarith...