-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathEven odd query
More file actions
42 lines (28 loc) · 830 Bytes
/
Copy pathEven odd query
File metadata and controls
42 lines (28 loc) · 830 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/python3
import os
import sys
# Complete the solve function below.
def solve(arr, queries):
lst = []
for i in queries:
if(i[0]<len(arr) and arr[i[0]]==0 and i[0]!=i[1]):
lst.append('Odd')
elif i[0] > i[1] :
lst.append("Odd")
elif arr[i[0]-1]%2 == 0:
lst.append("Even")
else:
lst.append("Odd")
return lst
if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PATH'], 'w')
arr_count = int(input())
arr = list(map(int, input().rstrip().split()))
q = int(input())
queries = []
for _ in range(q):
queries.append(list(map(int, input().rstrip().split())))
result = solve(arr, queries)
fptr.write('\n'.join(result))
fptr.write('\n')
fptr.close()