1027 - Enemy Target!
Time Limit : 2 Second
Memory Limit : 128 MB
- In the Game Red Alert, a group of soviet infantry marches towards our base. And we have N Prism Tanks to defend our base.
Suppose the coming infantry marches in a ROW*COLUMN rectangle grid, and keeps the shape unchanged. A Prism Tank can eliminate infantry in any row or column at a shot. Prism Tank is weak in self-defense, so your task is to assign the least Prism Tanks, fire simultaneously to eliminate all the invading enemies. If our Prism Tank is enough, submit any assignment using the least Prism Tanks. Otherwise, report it.
- First line: 3 integers ROW,COLUMN,N--number of Prism Tanks we have now(ROW<=1000, COLUMN<=1000,N<=1000).
Line 2 to ROW+1: Each line is a binary 01 string with length COLUMN, represent the shape of infantry. Set 1 if a position have a soldier, otherwise 0.
- If there exist an assignment, output it in the format:
ROW: R1 R2...Rk1
COLUMN: C1 C2...Ck2
k1+k2 is the totoal number of Prism Tanks.
Otherwise print one line "NOT ENOUGH TANK".
- sample input
4 4 4 0101 1010 1010 0010
- sample output
3 ROW: 1 COLUMN: 1 3