This one was really really really too simple. The easiest problem of round 1. Unfortunately I didn’t took part at 1A, I did 1B and 1C and I did not pass :^( Anyway I’ll keep doing those problem just to have some fun :^)

def solve(a,b): a.sort() b.sort(reverse = True) return sum([i[0]*i[1] for i in zip(a,b)]) |

You have to pass **a** and **b** as lists, or if you prefer vectors… I think there is no more to comment here… I did it just thinking about it and I find the solution out in about 3 minutes, but I discovered that mathematicians already thought about that and gave it a name :^D

You can search on wikipedia for Rearrangement inequality. I mean, 4 lines of fully readable python… it was quite simple, wasn’t it?

return YAWN;

Here is a part of my code:

I think it’s just but when I submit the output file, they say it’s incorrect

Try to convert to int before sorting, so far it seems correct to me. Are you sure you’re not messin up with the output? There are some strict rules about that.

Thank you. I convert to int before sorting and it works.