F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

How Many People Can Survive

Time 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
3 3 ..# ovo ¡­ 10 10 ...vvvoo.. ########## #....oo.o# #..v.v...# #........# #..####..# #..#o.#..# #..#.v#..# #..####..# ##########
 

Sample Output
0 0 3 0
 

Author
dandelion
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 18:22:14, Gzip enabled