|
||||||||||
How Many People Can SurviveTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 511 Accepted Submission(s): 240 Problem Description Two opposing armies are lost in a big forest. The forest is dangerous ,because it is filled with poisonous gas . People can only survive by staying at the place that is surrounded by trees.As the two armies are opposing, if one army are able to move to the other one , they wil fight with each other. Only the army that with the more people will survive, if the number is equal, no one will survive. Now you are asked to find out how many people will survive. Input There are several test cases. Each case begins with an integer n and m (3<=n,m<=300) stands for the size of forest. Then follows n lines , each line contains m characters . ¡®.¡¯ Stands for empty place ¡®#¡¯Stands for tree and can¡¯t been walked through ¡®o¡¯Stands for the first army ¡®v¡¯stands for the second army Output The output contains one line for each data set : two integers, p and q, stands for the number of the first army that can survive and the number of the second army that can survive. Sample Input
Sample Output
Author dandelion Source | ||||||||||
|