【题解】AT2043 AND Grid

我们考虑直接构造两个互补的图切分别联通的图,然后原图有的大家都有就构造完成了。

#include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdio>
#include<queue>
#include<bitset>
#include<vector>
#include<map>
#include<ctime>
#include<cstdlib>
#include<set>
#include<bitset>
#include<stack>
#include<list>
#include<cmath>
using namespace std;
#define RP(t,a,b) for(register int (t)=(a),edd_=(b);t<=edd_;++t)
#define DRP(t,a,b) for(register int (t)=(a),edd_=(b);t>=edd_;--t)
#define ERP(t,a) for(int t=head[a];t;t=e[t].nx)
#define Max(a,b) ((a)<(b)?(b):(a))
#define Min(a,b) ((a)<(b)?(a):(b))
#define TMP template<class ccf>
#define lef L,R,l,mid,pos<<1
#define rgt L,R,mid+1,r,pos<<1|1
#define midd register int mid=(l+r)>>1
#define chek if(R<l||r<L)return
#define all 1,n,1
#define pushup(x) seg[(x)]=seg[(x)<<1]+seg[(x)<<1|1]
typedef long long ll;
TMP inline ccf qr(ccf k){
char c=getchar();
ccf x=0;
int q=1;
while(c<48||c>57)
q=c==45?-1:q,c=getchar();
while(c>=48&&c<=57)
x=x*10+c-48,c=getchar();
if(q==-1)
x=-x;
return x;
}
const int maxn=505;
bool g1[maxn][maxn];
int m,n; inline bool qrqr(){
char c=getchar();
while(c!='.'&&c!='#')
c=getchar();
return c=='#';
} int main(){
n=qr(1);
m=qr(1);
RP(t,1,n)
RP(i,1,m)
g1[t][i]=qrqr(); RP(t,1,n){
RP(i,1,m)
if(g1[t][i]||((t&1)&&i!=m)||i==1)
cout<<'#';
else
cout<<'.';
cout<<endl;
}putchar('\n');
RP(t,1,n){
RP(i,1,m)
if(g1[t][i]||((!(t&1))&&i!=1)||i==m)
cout<<'#';
else
cout<<'.';
cout<<endl;
}
return 0;
}

最新文章

  1. iOS开发 贝塞尔曲线
  2. js之数据类型
  3. C++基础入门
  4. [译]MongoDb生产环境注意事项
  5. 【Cardboard】 体验 - Google Cardboard DIY及完成后简单体验
  6. Super Hide IP 3.4.7.8允许您以匿名方式进行网上冲浪、 保持隐藏您的 IP 地址
  7. SSRS(rdl报表)分页显示表头和冻结表头
  8. retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1 SECONDS)
  9. Nagios安装部署
  10. 分页功能的实现——Jdbc &amp;&amp; JSP
  11. 【Ubuntu16】apt-get安装MariaDB
  12. Less与TypeScript的简单理解与应用,并使用WebPack打包静态页面
  13. es6 filter() 数组过滤方法总结
  14. MySQL主从复制报错1594处理【转】
  15. 前端单页面富应用(SPA)的实现
  16. vue params和query传参区别
  17. zabbix实现企业微信监控报警
  18. spring mvc防止表单重复提交的代码片段
  19. angular中的jqLite所包含的jquery API
  20. 玩转X-CTR100 | X-PrintfScope波形显示

热门文章

  1. UVA 11100 The Trip, 2007 水题一枚
  2. Install Ruby on Rails on Ubuntu 12.04 LTS
  3. [LeetCode] 1.Two Sum 两数之和分析以及实现 (golang)
  4. python pandas相关知识点(练习)
  5. php+mysql两次左外联跨表查询
  6. django发送邮件配置
  7. AutoIt3常见问题解答
  8. 【日常学习】【并查集+map】codevs2639 约会计划题解
  9. Vue框架引入JS库的正确姿势
  10. eclipse svn插件 删除原账号信息重新登录