Blinking LED
Time Limit : 10 Second
Memory Limit : 128 MB
Submission: 15
Solved: 6
- Description
- There are 10 LEDs lies horizonally on a building, each LED with length 3600 and have some light spots.
Each second, every LED i shifts from left to right cyclically with its own speed si. You are told the initial position of each light spot, and please tell us the earliest time when exist vertical line all formed by light spots.
- Input
- Line 1-10: each line first contains two integers, si,di-speed and number of light spots on i`th LED, followed by di integers: c1,c2...c(di), indicate the position of light spots initially(range in [0,3599]).
d1+d2+...+d10 <= 3600
- Output
- One integer indicate the ealist time when exist vertical line all formed by light spots. If light vertical line does not exist, output a line: "NEVER".
- sample input
-
1 1 1 2 1 2 3 1 3 4 1 4 5 1 5 6 1 6 7 1 7 8 1 8 9 1 9 10 1 10
- sample output
-
3599
- hint
- source
- liruqi