#include #include #include #include #include using namespace std; #define MEM(a,b) memset(a,(b),sizeof(a)) #define MAX(a,b) ((a) > (b) ? (a) : (b)) #define MIN(a,b) ((a) < (b) ? (a) : (b)) #define MP make_pair #define pb push_back #define maxn 1000 #define maxt 10 typedef long long LL; typedef pair pi; typedef pair pii; //vector divs[maxd+1] char grid[1505][1505]; int hor[1505],ver[1505]; int main() { int i,j,k,n,q,T; // Generates the divisors // for(i=1;i<=maxd;i++) // for(j=i;j<=maxd;j+=i) divs[j].pb(i); scanf("%d",&T); assert(T>=1 && T<=maxt); while(T--) { scanf("%d",&n); assert(n>=1 && n<=maxn); int g; for(i=0;i=0;j--) { if(grid[i][j]=='.') continue; hor[i]=j; // mark the rightmost column of row i which has an obstacle break; } } for(j=0;j=0;i--) { if(grid[i][j]=='.') continue; ver[j]=i; // mark the bottom most row of column j which has an obstacle break; } } for(i=0;ihor[i] && i>ver[j]) ans++; // if there is not obstacle on right or below, then a mirror can be placed there printf("%d\n",ans); } return 0; }