Don't ask me why I've been goo for two days.
Test instructions
Give a $h\times w$ grid graph A, only by '. ' and ' # ', there is no ' # ' on the boundary and there is at least one ' # '. Constructs two grids B and C, all sizes are $h\times w$, requires a in the ' # ' position B, C is also ' # ', A is '. ' The position B, C cannot all be ' # ', and B, C in the ' # ' form of the Unicom block has and only one.
$3\leq H,w\leq 500$
There's SPJ.
Exercises
This problem seems to have nothing to do with the data range ...
Dare to write dare?
b in the first column and Ciriè fill ' # ', C, even and the last column fill ' # ', must meet the conditions
Don't ask me how to testify, Orzwzd.
Code:
1#include <algorithm>2#include <iostream>3#include <cstring>4#include <cstdio>5#include <cmath>6#include <queue>7 #defineINF 21474836478 #defineEPS 1e-99 using namespacestd;TentypedefLong Longll; One intn,m; A Chara[501][501],b[501][501],c[501][501]; - intMain () { -scanf"%d%d",&n,&m); the for(intI=1; i<=n;i++) scanf ("%s", a[i]+1); - for(intI=1; i<=n;i++){ - for(intj=1; j<=m;j++){ - if(a[i][j]=='#') b[i][j]=c[i][j]='#'; + Elseb[i][j]=c[i][j]='.'; - } + } A for(intI=1; i<=m;i++) b[1][i]=c[n][i]='#'; at for(intI=1; i<=m;i++){ - for(intj=2; j<n;j++){ - if(i&1) b[j][i]='#'; - Elsec[j][i]='#'; - } - } in for(intI=1; i<=n;i++) printf ("%s\n", b[i]+1); -printf"\ n"); to for(intI=1; i<=n;i++) printf ("%s\n", c[i]+1); + return 0; -}
[Agc004c]and Grid