Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Input: MaxWorkLoad: example 10
- Timeslot and workload: example [(2, 6, 3), (3, 8, 2), ... ]
- The (2, 6, 3) is begin time, end time, and workload
- You can treat the 2, 6 as the UNIX epoch time.
- The time may not be integers, so instead of 2, it can be 2.2
- The input can be in any time order. For example: [(20, 60, 3), (3, 8, 2)]
- The workload will "add up", so a 3 and 2 will add up to 5
- Output: a boolean returning whether the series of workload can fit in without
- exceeding MaxWorkLoad
- dict[beginTime] ||= 0; // if not defined, then set it to 0
- dict[beginTime] += workload;
- dict[endTime] ||= 0;
- dict[endTime] -= workload;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement