CIRMERGE - Editorial

I hope this will work

4 Likes

how you know so much math and algorithms where did you learn from ?? can u make a post and give us tips please??

2 Likes

I may not be able to give you any omnipotent solution, because every problem corresponds to some knowledge. You canā€™t expect a link to help you in all respects. My hint to you is to learn what you need from anywhere you can find, and then use your own thinking to understand it, not just remember it.

2 Likes

Ok thanks . any books or specific resources you use?

2 Likes

By my algorithm
8 + 3 = 11
6 + 11 = 17
17 + 10 = 27
27 + 20 = 47
Answer = 102. You win!
Thank you for pointing this out.

for n<=4, we can prove that your soln will always work.
But for higher n, it starts to deviate.

@anand20 for task 2 how did you find greedy is enough ? I did that approach only assuming it will be correct for all subtasks. Any proof of concept would help.

I Got Accepted this By Just rotating the array in such a way that the maximum element should be at last and Assume it to be a simple problem without circular merging(First and last canā€™t be merged).
Any proof for this Solution will be appreciatedā€¦:smiley::smiley:

1 Like

can someone pls explain how O(N!) is achieved in the pseudo code given for Subtask 1 ??

I also used the same way. And got the same resultā€¦

Did same and got same answer

Oh thatā€™s why! I tried to figure some test case like this but couldnā€™t. Thanks !

Twice may not be enough.

any python solution for this, unable to find the solution which got 100 points

Used mod operator in my solution, passed all the test cases.

You can check my solution
https://www.codechef.com/viewsolution/25149691
It gave TLE in Python but got passed in PYPY.
You can ask for any clarification

Yes actually same problem with me, same i have tried greedy to find solution, but i got AC in sub task 2, so that means it is not necessary to pick the pair of minimum sum, but instead we have to check all of the pairs every timeā€¦

How do get these algorithm, who are unknown for me. Do you have any resource??

You can see my commit above. :relaxed::kissing::kissing:

https://www.codechef.com/viewsolution/25331739
Complexity is O(T*N^3) still I get TLE. Iā€™ve tried PYPY3 also.
There are no 100 points solutions I could find in python3.