Codeforces Round #385 (Div. 2) B
来源:互联网 发布:淘宝运营浏览器插件 编辑:程序博客网 时间:2024/06/06 00:44
就是判断矩形
水题,自己太菜了
#include<cstdio>#include<cstring>#include<algorithm>#include<iostream>using namespace std;int main(){int n,m;char a[505][505];scanf("%d %d",&n,&m);for(int i=0;i<n;i++)scanf("%s",a[i]);int x1=-1,x2=-1,x3=-1,x4=-1,y1=-1,y2=-1,y3=-1,y4=-1;for(int i=0;i<n;i++){for(int j=0;j<m;j++){if(a[i][j]=='X'){x1=i; y1=j;for(int k=m-1;k>=0;k--){if(a[i][k]=='X'){x2=i; y2=k; break;}}break;} } if(x1!=-1) break;}for(int i=n-1;i>=0;i--){for(int j=0;j<m;j++){if(a[i][j]=='X'){x3=i; y3=j;for(int k=m-1;k>=0;k--){if(a[i][k]=='X'){x4=i; y4=k; break;}}break;} } if(x3!=-1) break;}if(y1!=y3||y2!=y4||x1!=x2||x3!=x4) printf("NO\n");else {int t=0;for(int i=x1;i<=x3;i++){for(int j=y1;j<=y2;j++)if(a[i][j]=='.') {t=1; break;}if(t==1) break;}if(t) printf("NO\n");else printf("YES\n"); } }
阅读全文
0 0
- Codeforces Round #385 (Div. 2) B
- Codeforces Round #385 (Div. 2) B. Hongcow Solves A Puzzle
- Codeforces Round #131 (Div. 2) A B
- Codeforces Round #134 (Div. 2)B. Airport
- Codeforces Round #170 (Div. 2) problem B
- Codeforces Round #173 (Div. 2) Problem B
- Codeforces Round #181 (Div. 2) B. Coach
- Codeforces Round #185 (Div. 2)--A,B
- Codeforces Round #171 (Div. 2) B
- Codeforces Round #169 (Div. 2) B题
- Codeforces Round #188 (Div. 2) B题
- Codeforces Round #192 (Div. 2) B
- Codeforces Round #203 (Div. 2) B. Resort
- Codeforces Round #206 (Div. 2) - b
- Codeforces Round #202 (Div. 2)B-贪心
- Codeforces Round #203 (Div. 2)B
- Codeforces Round #203(Div. 2)B. Resort
- Codeforces Round #206 (Div. 2)B
- Android .9.png图片的制作与使用
- 关于深度学习入门需要掌握的技能
- opencv的基本数据结构
- matlab与opoencv之间的基本矩阵运算转换
- SSM简单整合
- Codeforces Round #385 (Div. 2) B
- 解决分布式定时任务执行多次问题
- log4j配置示例
- 对于crudrepository怎么解决update的问题
- LINUX--hadoop部署
- Linux CAN通信
- 第二章 模型构建与选择
- 仿照django的urls风格和模块化结构的flask项目(Django-Style URL Patterns for Flask)
- hibernate之一对多|多对多案例|关联映射(03)