Data Structures & AlgorithmsVery hardCodeforces Div2 B-D · ICPC regional

Four unit-time jobs given as (deadline, profit) are (4, 20), (1, 10), (1, 40), (1, 30). Each job must finish by its deadline and only one runs per time unit. What is the maximum total profit achievable?

  1. A. 60
  2. B. 70
  3. C. 100
  4. D. 50

Correct answer: A. 60

Process jobs by decreasing profit and place each in the latest free slot not after its deadline (a greedy with exchange argument). Only one deadline-1 job fits, so the 40 is taken and 30 and 10 are dropped.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic