[Agc004c]and Grid

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.