Untitled
unknown
plain_text
9 months ago
786 B
2
Indexable
from typing import List
def frogs(X: List[int], S: List[int], Y: List[int]) -> List[int]:
# Initialize the result list
result = []
for i in range(len(X)):
count = 0
for fly in Y:
# Check if the fly is within the frog's tongue range
if abs(X[i] - fly) <= S[i]:
count += 1
result.append(count)
return result
# Input handling (Do not change)
if __name__ == '__main__':
line = input()
X = [int(i) for i in line.strip().split()]
line = input()
S = [int(i) for i in line.strip().split()]
line = input()
Y = [int(i) for i in line.strip().split()]
output = frogs(X, S, Y)
if output == []:
print('[]')
else:
print('[%s]' % ','.join(map(str, output)))
Editor is loading...
Leave a Comment