B. One Bomb
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

You are given a description of a depot. It is a rectangular checkered field of n × m size. Each cell in a field can be empty (".") or it can be occupied by a wall ("*").

You have one bomb. If you lay the bomb at the cell (x, y), then after triggering it will wipe out all walls in the row x and all walls in the column y.

You are to determine if it is possible to wipe out all walls in the depot by placing and triggering exactly one bomb. The bomb can be laid both in an empty cell or in a cell occupied by a wall.

Input

The first line contains two positive integers n and m (1 ≤ n, m ≤ 1000) — the number of rows and columns in the depot field.

The next n lines contain m symbols "." and "*" each — the description of the field. j-th symbol in i-th of them stands for cell (i, j). If the symbol is equal to ".", then the corresponding cell is empty, otherwise it equals "*" and the corresponding cell is occupied by a wall.

Output

If it is impossible to wipe out all walls by placing and triggering exactly one bomb, then print "NO" in the first line (without quotes).

Otherwise print "YES" (without quotes) in the first line and two integers in the second line — the coordinates of the cell at which the bomb should be laid. If there are multiple answers, print any of them.

Examples
input
3 4
.*..
....
.*..
output
YES
1 2
input
3 3
..*
.*.
*..
output
NO
input
6 5
..*..
..*..
*****
..*..
..*..
..*..
output
YES
3 3

题意:

让你找一个点,放一个炸弹,使所有的*都被炸掉,炸弹只影响行列,和炸弹的那个点

题解:

行列统计一下又多少个*,然后暴力枚举每一个点,看这行这列的*的个数是否达到了全部的*的个数

 #include<cstdio>
#include<vector>
#include<cstring>
#include<algorithm>
#define pb push_back
#define F(i,a,b) for(int i=a;i<=b;++i)
using namespace std;
typedef long long LL;
int n,m,anx,any,cnt=;
char g[][];
vector<int>Gu[],Gv[]; int main(){
scanf("%d%d",&n,&m);
F(i,,n){
getchar();
F(j,,m){
g[i][j]=getchar();
if(g[i][j]=='*'){
cnt++,anx=i,any=j;
Gu[i].pb(j);
Gv[j].pb(i);
}
}
}
if(cnt==){
printf("YES\n%d %d\n",anx,any);
return ;
}
F(i,,n)F(j,,m){
int ann=Gu[i].size()+Gv[j].size();
if(g[i][j]=='*')ann--;
if(ann==cnt){
printf("YES\n%d %d\n",i,j);
return ;
}
}
puts("NO");
return ;
}

Codeforces Round #363 (Div. 2) B. One Bomb (水题)的更多相关文章

  1. Codeforces Round #367 (Div. 2) A. Beru-taxi (水题)

    Beru-taxi 题目链接: http://codeforces.com/contest/706/problem/A Description Vasiliy lives at point (a, b ...

  2. Codeforces Round #334 (Div. 2) A. Uncowed Forces 水题

    A. Uncowed Forces Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/604/pro ...

  3. Codeforces Round #353 (Div. 2) A. Infinite Sequence 水题

    A. Infinite Sequence 题目连接: http://www.codeforces.com/contest/675/problem/A Description Vasya likes e ...

  4. Codeforces Round #363 (Div. 2)->B. One Bomb

    B. One Bomb time limit per test 1 second memory limit per test 256 megabytes input standard input ou ...

  5. Codeforces Round #363 (Div. 2) B. One Bomb —— 技巧

    题目链接:http://codeforces.com/contest/699/problem/B 题解: 首先统计每行每列出现'*'的次数,以及'*'出现的总次数,得到r[n]和c[m]数组,以及su ...

  6. Codeforces Round #335 (Div. 2) B. Testing Robots 水题

    B. Testing Robots Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://www.codeforces.com/contest/606 ...

  7. Codeforces Round #327 (Div. 2) A. Wizards' Duel 水题

    A. Wizards' Duel Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/591/prob ...

  8. Codeforces Round #146 (Div. 1) A. LCM Challenge 水题

    A. LCM Challenge 题目连接: http://www.codeforces.com/contest/235/problem/A Description Some days ago, I ...

  9. Codeforces Round #335 (Div. 2) A. Magic Spheres 水题

    A. Magic Spheres Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://www.codeforces.com/contest/606/ ...

随机推荐

  1. 高性能MySQL第2,3章性能相关 回顾笔记

    1.  基准测试(benchmark)   不管是新手还是专家都要熟悉基准测试,benchmark测试是对系统的一种压力测试,目标是为了掌握在特定压力下系统的行为.也有其他原因:如重现系统状态,或者是 ...

  2. 安装vb6 正在更新系统 无响应

    新装的win10系统,安装vb6时,最后一直卡在“正在更新系统”,程序无响应,没办法,kill掉后,貌似不影响软件使用,但是安装vs6sp6B无法成功安装. 解决办法是: 不安装“数据访问”组件. 参 ...

  3. Tcp Socket非阻塞recv

    最近看了许多关于网络编程的资料,自己小记一下,以方便以后查找. 什么是阻塞socket,什么是非阻塞socket.对于这个问题,我们要先弄清什么是阻塞/非阻塞.阻塞与非阻塞是对一个文件描述符指定的文件 ...

  4. php学习的第8天

    晚上老师布置啦17题算数问题的作业 我一看 感觉挺容易的 动手就开始做啦起来 不知不觉也9点多啊 终于做好前部题目 发现这我3个月前也遇到类似的题目 那是我还一题都做一题用上1个钟左右 好多也做不出 ...

  5. Apache Commons DbUtils 快速上手

    原文出处:http://lavasoft.blog.51cto.com/62575/222771 Hibernate太复杂,iBatis不好用,JDBC代码太垃圾,DBUtils在简单与优美之间取得了 ...

  6. Android自动测试之Monkey工具

    Monkey工具 前言: 最 近开始研究Android自动化测试方法,对其中的一些工具.方法和框架做了一些简单的整理,其中包括android测试框架.CTS.Monkey. Monkeyrunner. ...

  7. Linux 压缩解压命令

    .tar 解包:tar xvf FileName.tar 打包:tar cvf FileName.tar DirName (注:tar是打包,不是压缩!) ---------------------- ...

  8. git的理念

    一个很好的git教程:http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000 1  集中式 ...

  9. .net文件上传,客户端用jquery file upload

    <%@ WebHandler Language="C#" Class="Handler" %> using System; using System ...

  10. Linux启动流程详解【转载】

    在BIOS阶段,计算机的行为基本上被写死了,可以做的事情并不多:一般就是通电.BIOS.主引导记录.操作系统这四步.所以我们一般认为加载内核是linux启动流程的第一步. 第一步.加载内核 操作系统接 ...