Embercode
✕
Dynamic ProgrammingQuick quiz

Bitmask assignment

6 questions. Covers Bitmask DP: assigning tasks to people.

Questions 1 to 5 of 6

  1. 1. A team has 20 people and 20 tasks, and every pair is allowed. The bitmask table has one entry for each mask, and each entry tries at most 20 tasks. What is the largest number of steps the table takes in total?

    Type a number.

  2. 2. Five people and five tasks, with every pair allowed. How many masks are in the layer where exactly 2 people are done?

    Type a number.

  3. 3. The first cost table in the lesson has people in rows and tasks in columns. What total does the greedy rule give? The greedy rule lets each person in turn take the cheapest task that is still free.
  4. 4. Why does run_dp use std::popcount(mask) as the number of the next person to be given a task?
  5. 5. What number does the line next mask: print? ``cpp #include <bit> #include <iostream> int main() { unsigned mask = 0b10110; int person = std::popcount(mask); std::cout << "next person: " << person << '\n'; std::cout << "next mask: " << (mask | (1u << 0)) << '\n'; std::cout << "is task 2 taken: " << ((mask & (1u << 2)) != 0) << '\n'; } ``

5 question(s) left on this page.

Typed answers ignore extra spaces and, for most questions, capital letters.