-
Notifications
You must be signed in to change notification settings - Fork 111
/
solution.py
29 lines (21 loc) · 922 Bytes
/
solution.py
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
def countApplesAndOranges(s,t,a,b,apples,oranges):
app=0 # app denotes apples falling on house
ora=0 # ora denotes oranges falling on house
for i in apples:
if i + a <= t and i + a >= s:
app+=1 # app increment
for i in oranges:
if i + b <= t and i + b >= s:
ora+=1 # ora increment
print(app)
print(ora)
def main():
s,t = map(int,input().split(' ')) # s=start location t=end location
a,b = map(int,input().split(' ')) # a=apple tree location b=orange tree location
m,n = map(int,input().split(' ')) # m=apple count n=orange count
apples = list(map(int,input().split(' ')))
oranges = list(map(int,input().split(' ')))
countApplesAndOranges(s,t,a,b,apples,oranges) # Function call
# Code Execution
if __name__ == '__main__':
main()