Advertisement
Guest User

Untitled

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