Advertisement
Manioc

934A

Feb 17th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.50 KB | None | 0 0
  1. n, m = map(int, raw_input().split())
  2.  
  3. t = map(int, raw_input().split())
  4. b = map(int, raw_input().split())
  5.  
  6. maiores = max(t)*max(b)
  7. menores = min(t)*min(b)
  8. inverse1 = max(t)*min(b)
  9. inverse2 = min(t)*max(b)
  10.  
  11. final = max([maiores, menores, inverse1, inverse2])
  12. if final == maiores or final == inverse1:
  13.     t.remove(max(t))
  14. else: t.remove(min(t))
  15.  
  16. maiores = max(t)*max(b)
  17. menores = min(t)*min(b)
  18. inverse1 = max(t)*min(b)
  19. inverse2 = min(t)*max(b)
  20.  
  21. print max([maiores, menores, inverse1, inverse2])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement