Unfortunately the problem statement for this question was not clear and many people have misinterpreted it.
Your solution is correct for the question that you have interpreted which even i feel is logical. However the actual question is to find the minimum number of moves while maintaining the sorted property of the lists. e.g. 1 4 5 and 1 3 4. according to your solution replace 5 by 3 to make them equal in one move which gives 1 4 3 which is not sorted. According to the expected solution, the answer will be delete 5 and then insert 3 to get 1 3 4 which is in sorted order.
This problem is equivalent to the Edit Distance problem for strings which has a pretty standard O(n^2) Dynamic programming solution.
what the hell?? this is distubing!!
This question was showing wrong answer during the contest… Our team wasted all 2 hours trying to solve the same problem… But when when I saw the submission list, it showed that there was a successful submission at 24 minutes. We lost our whole time solving the one which we have already solved. Else we would have solved another and could have possibly made it to the final rank list. Please review into the matter
Here you can check that we tried to attempt the solved question
But @kcahdog Check comments by Admin. It says the final array need not be sorted
If you check the comments after that, @admin has admitted to mis-interpreting the question You cannot blame him for it as it was a problem with the question statement and he also made the same interpretation you did.
Yeah Just checked that…but if an admin makes a statement then it should be a correct one. Its little sad :(. I hope they re-evaluate it.
They will revaluate i guess. Its unfortunate such a thing had to happen in such a big contest.I stopped attempting the contest after i couldnt even solve this (easiest) problem.Hope i have better luck on amritapuri onsite.
what about the time i wasted for debugging the code i nearly wasted one and half hour on that. I was feeling frustrated for not solving any question and lost hope in between the contest. how that can be considered while judging.
@saurabh3240 even i have wasted too much time on that. It is unfortunate that it cannot be corrected now.
yes it is. but making a fuss about it will not solve anything. So please give code chef people some time to think peacefully and decide what to do.