409833: GYM103800 J Ginger's cow
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
J. Ginger's cowtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output
Ginger has a total of $$$n$$$ cows, he has $$$m$$$ old cows and $$$n-m$$$ small cows. Old cows can feed small cows, Ginger wants to pair as many cows with small cows as possible.
Ginger wants to know the maximum number of small cows that can be fed
InputThe first line contains three integers $$$m$$$ indicating the number of old cows, $$$n$$$ indicating the number of cows, $$$q$$$ indicating feeding relationship. $$$1 \le m \le n \le 100$$$, $$$1 \le q \le 10 ^ 3$$$
Next $$$q$$$ lines, each line has two strings $$$u, v$$$, representing old cows $$$u$$$ can feed small cows $$$v$$$
OutputPrint the maximum number of small cows that can be fed.
ExampleInput5 10 10 A G A H B F B I B J C G C H D G D H E JOutput
4