fork download
  1. import sys
  2. input = sys.stdin.readline
  3.  
  4. N= int(input())
  5.  
  6. lst = []
  7. for i in range(N):
  8. lst.append(int(input()))
  9. lst = sorted(lst)
  10. wights = lst[0]
  11. togather = 2
  12.  
  13. for i in range(1, N):
  14. if wights * togather >lst[i]:
  15. wights = wights * 2
  16. togather += 1
  17. elif wights * 2 <= lst[i]:
  18. wights = lst[i]
  19. togather = 2
  20.  
  21. print(wights)
Success #stdin #stdout 0.04s 9732KB
stdin
20
10000
10000
10000
10000
10000
10000
10000
10000
10000
10000
10000
10000
10000
10000
10000
10000
10000
10000
10000
10000
stdout
5242880000