Блог пользователя mavd09

Автор mavd09, история, 4 года назад, По-английски

Hi Codeforces!

I am dealing with the following problem:

Given N workers, each one has one or more time intervals that represent the time it will be available to work.

Also, I have M tasks, each one represented as an interval [from, to].

The problem is to assign all the tasks to the workers.

Each worker can only work in one task at the same time and each task must be executed just for one worker in the given interval, i.e. if the worker W_i is going to work in the task T_j, it must be available to work in the interval of this task.

It is guaranteed that a solution exists.

Assume that N and M are less than 100 and the intervals are between 0 and 20000.

One example, we have 2 workers:

The first worker will be available to work in the following intervals:

  1. [15, 37]

The second worker will be available to work in the following intervals:

  1. [30, 45]
  2. [55, 65]

And we have the following tasks:

  1. [20, 30]
  2. [55, 61]
  3. [31, 37]

So, one possible assignation could be:

  • [20, 30] -> Assigned to the first worker
  • [56, 61] -> Assigned to the second worker
  • [31, 37] -> Assigned to the first worker

Another solution could be:

  • [20, 30] -> Assigned to the first worker
  • [56, 61] -> Assigned to the second worker
  • [31, 37] -> Assigned to the second worker

I have a greedy approach, but not sure if it always works. I will be grateful if anyone can help me with any approach, idea or paper.

Thanks!

  • Проголосовать: нравится
  • +17
  • Проголосовать: не нравится

»
4 года назад, # |
  Проголосовать: нравится +12 Проголосовать: не нравится

Do you have a problem link?

»
4 года назад, # |
  Проголосовать: нравится +9 Проголосовать: не нравится

Does a worker have to spend the whole range on a given task, or do they just have to spend an unit of time?

  • »
    »
    4 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    They could have idle time, I updated the post with a simple example to clarify that.

»
4 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by mavd09 (previous revision, new revision, compare).

»
4 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by mavd09 (previous revision, new revision, compare).