【题解】AT2043 AND Grid
2024-09-07 16:31:59
【题解】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;
}
最新文章
- iOS开发 贝塞尔曲线
- js之数据类型
- C++基础入门
- [译]MongoDb生产环境注意事项
- 【Cardboard】 体验 - Google Cardboard DIY及完成后简单体验
- Super Hide IP 3.4.7.8允许您以匿名方式进行网上冲浪、 保持隐藏您的 IP 地址
- SSRS(rdl报表)分页显示表头和冻结表头
- retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1 SECONDS)
- Nagios安装部署
- 分页功能的实现——Jdbc &;&; JSP
- 【Ubuntu16】apt-get安装MariaDB
- Less与TypeScript的简单理解与应用,并使用WebPack打包静态页面
- es6 filter() 数组过滤方法总结
- MySQL主从复制报错1594处理【转】
- 前端单页面富应用(SPA)的实现
- vue params和query传参区别
- zabbix实现企业微信监控报警
- spring mvc防止表单重复提交的代码片段
- angular中的jqLite所包含的jquery API
- 玩转X-CTR100 | X-PrintfScope波形显示
热门文章
- UVA 11100 The Trip, 2007 水题一枚
- Install Ruby on Rails on Ubuntu 12.04 LTS
- [LeetCode] 1.Two Sum 两数之和分析以及实现 (golang)
- python pandas相关知识点(练习)
- php+mysql两次左外联跨表查询
- django发送邮件配置
- AutoIt3常见问题解答
- 【日常学习】【并查集+map】codevs2639 约会计划题解
- Vue框架引入JS库的正确姿势
- eclipse svn插件 删除原账号信息重新登录