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

Furion's Sprout

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 165    Accepted Submission(s): 42


Problem Description
Furion is the leader of all Night Elves in DOTA. He has a powerful and interesting skill: Szzprout. After he used this skill, several trees will grow quickly to form a square and trap enemy in this square. Now, give you the size of square and map of DOTA, please trap as many enemies as you can. If there are several solutions, show me the topmost one. If there's still a tie, show me the leftmost one.
 

Input
The first line contains an integer T indicating the number of test cases, and then follows T cases. The first line of each case contains three integer : X, the size of square, and N, the row number of map, and M, the column number of map. The rest of a case contains N lines, each contains M characters, which '.' indicating an empty grid, and 'x' indicating an grid occupied by an enemy.
0 < T <= 20, 1 < N <= 10, 1 < M <= 10, 1 < x <= min (N, M).
 

Output
Print N + 1 lines for each case. In the first line, print the number of trapped enemies Y in this format "Trapped Y enemy(ies).Ħħ
Then print a map with N lines and each line contains M characters. In each grip:
a) '.' stands for an empty grid;
b) 'T' stands for a grid occupied by a tree;
c) 'x' stands for a grip occupied by an enemy;
d) 'I' stands for a grip occupied by a tree and an enemy meanwhile.
Print a blank line after each case.
 

Sample Input
2 2 2 6 x.x.x. x.xx.. 3 6 3 .x. xx. ... .x. .xx ..x
 

Sample Output
Trapped 3 enemy(ies). x.ITx. x.II.. Trapped 4 enemy(ies). .x. xx. ... TIT TxI TTI
 

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-05-12 10:33:35, Gzip enabled