博客
关于我
Problem——B. Tiling Challenge——Codeforces
阅读量:278 次
发布时间:2019-03-01

本文共 1222 字,大约阅读时间需要 4 分钟。

???

?????????????????????????????????????????????????????????????????????????????????????????????????????"NO"?????"YES"?

???

#include 
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define ll long long#define dd double#define mes(x, y) memset(x, y, sizeof(y))using namespace std;ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b);}struct node { int x, y;};node z[3000];int main() { int n; cin >> n; int k = 0; char a[100][100]; for (int i = 0; i < n; ++i) { for (int j = 0; j < n; ++j) { cin >> a[i][j]; if (a[i][j] == '.') { z[k].x = i; z[k].y = j; ++k; } } } for (int i = 0; i < k; ++i) { int x = z[i].x; int y = z[i].y; if (x < 0 || x >= n || y < 0 || y >= n) { continue; } int cross_x[4] = {-1, 1, 0, 0}; int cross_y[4] = {0, 0, -1, 1}; bool is_cross = false; for (int d = 0; d < 4; ++d) { int nx = x + cross_x[d]; int ny = y + cross_y[d]; if (nx >= 0 && nx < n && ny >= 0 && ny < n) { if (a[nx][ny] == '.') { is_cross = true; break; } } } if (!is_cross) { a[x][y] = '#'; } } for (int i = 0; i < n; ++i) { for (int j = 0; j < n; ++j) { if (a[i][j] == '.') { cout << "NO" << endl; return; } } } cout << "YES" << endl;}

转载地址:http://ugvo.baihongyu.com/

你可能感兴趣的文章
OSG学习:几何体的操作(二)——交互事件、Delaunay三角网绘制
查看>>
OSG学习:几何对象的绘制(一)——四边形
查看>>
OSG学习:几何对象的绘制(三)——几何元素的存储和几何体的绘制方法
查看>>
OSG学习:几何对象的绘制(二)——简易房屋
查看>>
OSG学习:几何对象的绘制(四)——几何体的更新回调:旋转的线
查看>>
OSG学习:场景图形管理(一)——视图与相机
查看>>
OSG学习:场景图形管理(三)——多视图相机渲染
查看>>
OSG学习:场景图形管理(二)——单窗口多相机渲染
查看>>
OSG学习:场景图形管理(四)——多视图多窗口渲染
查看>>
OSG学习:新建C++/CLI工程并读取模型(C++/CLI)——根据OSG官方示例代码初步理解其方法
查看>>
Sql 随机更新一条数据返回更新数据的ID编号
查看>>
OSG学习:空间变换节点和开关节点示例
查看>>
OSG学习:纹理映射(一)——多重纹理映射
查看>>
OSG学习:纹理映射(七)——聚光灯
查看>>
OSG学习:纹理映射(三)——立方图纹理映射
查看>>
OSG学习:纹理映射(二)——一维/二维/简单立方图纹理映射
查看>>
OSG学习:纹理映射(五)——计算纹理坐标
查看>>
OSG学习:纹理映射(六)——灯光
查看>>
OSG学习:纹理映射(四)——三维纹理映射
查看>>
OSG:从源码看Viewer::run() 一
查看>>