-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathappleAndOrange.py
More file actions
28 lines (25 loc) · 796 Bytes
/
appleAndOrange.py
File metadata and controls
28 lines (25 loc) · 796 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
import os
def countApplesAndOranges(s, t, a, b, apples, oranges):
apples_count = oranges_count = 0
for apple in apples:
cur_apple_distance = a + apple
if cur_apple_distance >= s and cur_apple_distance <= t:
apples_count += 1
for orange in oranges:
cur_orange_distance = b + orange
if cur_orange_distance >= s and cur_orange_distance <= t:
oranges_count += 1
print(F"{apples_count}\n{oranges_count}")
if __name__ == '__main__':
st = input().split()
s = int(st[0])
t = int(st[1])
ab = input().split()
a = int(ab[0])
b = int(ab[1])
mn = input().split()
m = int(mn[0])
n = int(mn[1])
apples = list(map(int, input().rstrip().split()))
oranges = list(map(int, input().rstrip().split()))
countApplesAndOranges(s, t, a, b, apples, oranges)