Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # add your code here
- import sys
- critical = int(input())
- mushrooms = []
- count = 0
- #for i in sys.stdin:
- mushrooms.extend(input().split())
- mushrooms = list(map(int, mushrooms))
- result = [0]*len(mushrooms)
- #print(result)
- for mush in range(len(mushrooms)):
- idx = mush
- while count < critical and idx < len(mushrooms):
- count += mushrooms[idx]
- idx += 1
- if count < critical:
- result[mush] = 0
- elif idx == mush:
- result[mush] = 1
- else:
- result[mush] = idx - mush
- idx = 0
- count = 0
- #print(result)
- for i in result:
- print(i, end=" ")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement