Description

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.

Sample Input

Input
3 4
.*..
....
.*..
Output
YES
1 2
Input
3 3
..*
.*.
*..
Output
NO
Input
6 5
..*..
..*..
*****
..*..
..*..
..*..
Output
YES
3 3 题意:给你一个n*m的矩阵 ‘*’代表墙 现在只允许摆放一个炸弹 使得炸掉所有的墙
若炸弹的坐标为(i,j) 则第i行和第j列所有的墙都会被炸掉; 题解:预处理记录每一行每一列墙的个数
枚举每一个位置 判断能否炸掉所有的墙 hack数据
2 2
..
..
YES
1 1
 #include<iostream>
#include<cstring>
#include<cstdio>
#include<queue>
#include<stack>
#include<vector>
#include<map>
#include<algorithm>
#define ll __int64
#define mod 1e9+7
#define PI acos(-1.0)
using namespace std;
int n,m;
char mp[][];
int h[];
int l[];
int main()
{
scanf("%d %d",&n,&m);
memset(h,,sizeof(h));
memset(l,,sizeof(l));
getchar();
int zha=;
for(int i=;i<=n;i++)
{
for(int j=;j<=m;j++)
{
scanf("%c",&mp[i][j]);
if(mp[i][j]=='*')
{
zha++;
h[i]++;
l[j]++;
}
}
getchar();
}
for(int i=;i<=n;i++)
{
for(int j=;j<=m;j++)
{
if(mp[i][j]=='*')
{
if((h[i]+l[j]-)==zha)
{
cout<<"YES"<<endl;
cout<<i<<" "<<j<<endl;
return ;
}
}
else
{
if((h[i]+l[j])==zha)
{
cout<<"YES"<<endl;
cout<<i<<" "<<j<<endl;
return ;
}
} }
}
cout<<"NO"<<endl;
return ;
}

Codeforces Round #363 (Div. 2) B 暴力的更多相关文章

  1. Codeforces Round 363 Div. 1 (A,B,C,D,E,F)

    Codeforces Round 363 Div. 1 题目链接:## 点击打开链接 A. Vacations (1s, 256MB) 题目大意:给定连续 \(n\) 天,每天为如下四种状态之一: 不 ...

  2. Codeforces Round #363 (Div. 2)

    A题 http://codeforces.com/problemset/problem/699/A 非常的水,两个相向而行,且间距最小的点,搜一遍就是答案了. #include <cstdio& ...

  3. 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 ...

  4. Codeforces Round #363 (Div. 1) B. Fix a Tree 树的拆环

    题目链接:http://codeforces.com/problemset/problem/698/B题意:告诉你n个节点当前的父节点,修改最少的点的父节点使之变成一棵有根树.思路:拆环.题解:htt ...

  5. Codeforces Round #253 (Div. 2)B(暴力枚举)

    就暴力枚举所有起点和终点就行了. 我做这题时想的太多了,最简单的暴力枚举起始点却没想到...应该先想最简单的方法,层层深入. #include<iostream> #include< ...

  6. Codeforces Round #363 (Div. 2) D. Fix a Tree —— 并查集

    题目链接:http://codeforces.com/contest/699/problem/D D. Fix a Tree time limit per test 2 seconds memory ...

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

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

  8. Codeforces Round #363 (Div. 2) C. Vacations —— DP

    题目链接:http://codeforces.com/contest/699/problem/C 题解: 1.可知每天有三个状态:1.contest ,2.gym,3.rest. 2.所以设dp[i] ...

  9. Codeforces Round #363 (Div. 2)A-D

    699A 题意:在一根数轴上有n个东西以相同的速率1m/s在运动,给出他们的坐标以及运动方向,问最快发生的碰撞在什么时候 思路:遍历一遍坐标,看那两个相邻的可能相撞,更新ans #include< ...

随机推荐

  1. python 进程之间的通讯

    python 进程之间的通讯 #!/usr/bin/env python #-*- coding:utf-8 -*- # author:leo # datetime:2019/5/28 10:15 # ...

  2. web项目小总结

     初步小结 1.之前的CSS有些遗忘,返回去重新看知识点,频繁会浪费项目时间. 比如说: position定位 1 position: absolute;//绝对定位 2 position:relat ...

  3. R+hadoop

    这里面的配置 http://www.rdatamining.com/big-data/r-hadoop-setup-guide root@kali:~/hadoop_home/hadoop-1.2.1 ...

  4. GPT分区表的备份与恢复

    GPT分区表的备份与恢复  keenshoes 2016-01-13 21:02:25 关键词: GPT, Partition, MBR,APPLE, GUID, Protective MBR 对于现 ...

  5. JS位运算和遍历

    JS位运算符 整数 有符号整数:允许使用正数和负数,第32位作为符号位,前31位才是存储位 无符号整数:只允许用正数 如果用n代表位 位数 = 2^n-1 由于位数(1.2.4.8.16...)中只有 ...

  6. 【数学 随机 技巧】cf364D. Ghd

    随机化选讲的例题 John Doe offered his sister Jane Doe find the gcd of some set of numbers a. Gcd is a positi ...

  7. Java poi 导出Excel并下载到客户端

    Maven配置,包含了其他文件格式的依赖,就全贴出来了 <dependency> <groupId>org.apache.poi</groupId> <art ...

  8. java的模运算

    在学习某个加密算法的时候留意到模运算,仔细查了资料后才注意到Java中的 % 其实是取余而不是取模,但是百度的时候找到的很多文章都把Java的 % 直接当成取模来用了,为了少踩坑所以自己整理了一下写了 ...

  9. 【Ecshop】后台菜单与权限管理

    主要php文件: 1,admin/includes/inc_menu.php ECSHOP管理中心菜单数组--配置菜单组及URL 2,languages/zh_cn/admin/common.php  ...

  10. 数据存储之使用MongoDB数据库存储数据

    安装MongoDB环境: 1.官网下载:https://www.mongodb.com/download-center#community 2.MongoDB可视化工具compass下载https:/ ...