This problem doesn't require anything sophisticated. Fact: you'll get the highest possible product if you multiply the highest number in the first list by the highest number in the second list.
Well, thanks to [color=red]kawigi [/color] for so many good problems on Sphere, but this one is purely mathematical, coding part is sorting only. Once we started to programming, let's do programming We would like to see such problems as "Exchange Operations" here, and 851 - "Maze" on UVa.
Anyone please explain, I used Arrays.sort() in java to sort the array. When I used merge sort, I got TLE, where as when I used merge sort the code got accepted. How it happens? Time complexity of merge sort is always <= timecomplexity of quick sort, right?