2016-17 Woburn Challenge Finals Round - Senior Division
Having fortunately gotten wind of the Cow-Bot's construction before
meeting it in battle, the monkeys are in the process of frantically
creating a virus, with the hopes of installing it into the robot and
shutting it down! They've finished writing their program, which consists
of
At any point in time, each line of code either contains a bug, or
doesn't. Initially, each line
Each minute, the monkeys can select one line of code which contains a
bug, and fix that bug! Unfortunately, their code is so fragile that
fixing some bugs may introduce others. If a bug is fixed on line
In order to efficiently proceed with making their viral code as correct
as possible, the monkeys are interested in the answers to two questions.
Firstly, what's the minimum possible number of lines of code which can
be left containing bugs after they fix as many bugs as they'd like to?
And secondly, how quickly can that minimum number of outstanding bugs be
achieved? If
In test cases worth
In test cases worth another
In test cases worth another
Input Specification
The first line of input consists of two space-separated integers
Output Specification
If
Otherwise if
Sample Input
10 2
1 4
0 0
0 8
0 10
0 0
1 0
1 4
1 4
1 5
0 7
Sample Output
1 6
Sample Explanation
One optimal sequence of lines to debug is:
After this sequence, the only line containing a bug will be line
Comments