Skip to content

Instantly share code, notes, and snippets.

@qkreltms
Created September 2, 2018 07:20
Show Gist options
  • Select an option

  • Save qkreltms/bee416489888a856c882ee3f1cdc0bcf to your computer and use it in GitHub Desktop.

Select an option

Save qkreltms/bee416489888a856c882ee3f1cdc0bcf to your computer and use it in GitHub Desktop.
L = int(input())
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())), reverse=True)
B = B[L-len(B):]
S = sum([A[i] * B[i] for i in range(L)])
print(S)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment