UVa 10919

From Algorithmist
Jump to navigation Jump to search

10919 - Prerequisites?[edit]

Summary[edit]

Given a list of classes taken and some conditions of the form "take k classes from this set", determine whether all of the conditions are satisfied.

Explanation[edit]

Pretty simple. Read in the list of classes taken, then loop over all requirements. Since classes can be used to fulfill multiple prerequisites, we don't have to worry about "using up" any of the classes that we've taken. With the problem constraints at most 100, pretty much anything will run in time.

Notes[edit]

Solutions[edit]

Input[edit]

3 2
0123 9876 2222
2 1 8888 2222
3 2 9876 2222 7654 
3 2
0123 9876 2222
2 2 8888 2222
3 2 7654 9876 2222
0

Output[edit]

yes
no