|
||||||||||
Chinese ChessTime Limit: 30000/15000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 945 Accepted Submission(s): 143 Problem Description Winnie is very interested in chinese chess. Now, let's consider a game which is similar to it. There is a N * M chess board, we hope we can put rooks as more as possible. But just a certain number of postions can be put rooks on. One rook can attack another if they are in the same row or column. Now you may think this is a very simple problem for you. But as very whuacmers know, winnie is evil enough to cheat you. Let's consider some positions called critical postions. If we don't put rook on the critical position, the maximum number of rook we can put on this chess board will reduce. How many critical positions on the chess board? Input Input will contain multiple test cases. The first line contains three numbers N, M, K(N, M ¡Ü 10000, K ¡Ü 100000) which indicate height, width and number of positions which can be put rook on. Then next K lines follow, each contains two integer X ans Y which indicate we can put rook on the Xth row, Yth column. Output Output as follow: Board T have C important blanks for L chessmen. C indicate the number of critical positions ans L indicate the maximum rooks can be put. Sample Input
Sample Output
Hint Hint: huge input, use scanf please. Source | ||||||||||
|