Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- N = int(input())
- s = 8
- buf = [1000]*s
- buf_even = [1000]*s
- result = 1001*1001
- n = int(input())
- if n % 2 == 0:
- buf_even[0] = n
- buf[0] = n
- for i in range(1, s):
- n = int(input())
- if n % 2 == 0:
- buf_even[i] = min(buf_even[i-1], n)
- else:
- buf_even[i] = buf_even[i-1]
- buf[i] = min(buf[i-1], n)
- for i in range(s, N):
- n = int(input())
- if n % 2 == 0:
- result = min(n * buf[i % s], result)
- buf_even[i % s] = min(n, buf[(i-1) % s])
- else:
- result = min(n * buf_even[i % s], result)
- buf[i % s] = min(n, buf[(i-1) % s])
- if result != 1001*1001: print(result)
- else: print(-1)
Advertisement
Add Comment
Please, Sign In to add comment