import java.io.PrintStream; import java.util.Arrays; import java.util.Scanner; /** * Solution to Light Up * * @author vanb */ public class lightup_vanb { /** Input. */ private static Scanner sc; /** Output. */ private static PrintStream ps; private void dump( char grid[][] ) { for( char row[] : grid ) { System.err.println( new String( row ) ); } } /** * Do it! */ private void doit() { int n = sc.nextInt(); char grid[][] = new char[n][]; for( int i=0; i=0 && (grid[d][j]=='.' || grid[d][j]=='#'); --d ) grid[d][j] = '#'; if( d>=0 && grid[d][j]=='?' ) ok = false; for( d=i+1; d=0 && (grid[i][d]=='.' || grid[i][d]=='#'); --d ) grid[i][d] = '#'; if( d>=0 && grid[i][d]=='?' ) ok = false; for( d=j+1; d=0 && grid[i-1][j]=='?' ) ++count; if( i+1=0 && grid[i][j-1]=='?' ) ++count; if( j+1