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<stdio.h>
#include<iostream>
#include<map>
using namespace std;
char ma[][];
int main(){
int n,m;
int x=-;
int y=-;
int hang[];
int lie[];
int cnt=;
scanf("%d%d",&m,&n);
for(int i=;i<m;i++) hang[i]=;
for(int j=;j<n;j++) lie[j]=;
for(int i=;i<m;i++){
scanf("%s",ma[i]);
}
for(int i=;i<m;i++){
for(int j=;j<n;j++){
if(ma[i][j]=='*'){
hang[i]++;
lie[j]++;
cnt++;
}
} }
for(int i=;i<m;i++){
for(int j=;j<n;j++){
int tmp=hang[i]+lie[j];
if(ma[i][j]=='*') tmp--;
if(tmp==cnt){
printf("YES\n%d %d",i+,j+);
return ;
}
}
}
printf("NO\n");
return ;
}

分别统计行和列中到墙的个数,如果某个 行和列中包含全部到墙,则为答案。

cf #363 b的更多相关文章

  1. cf #363 d

      time limit per test 2 seconds memory limit per test 256 megabytes input standard input output stan ...

  2. cf #363 c

    C. Vacations time limit per test 1 second memory limit per test 256 megabytes input standard input o ...

  3. cf #363 a

    A. Launch of C time limit per test 2 seconds memory limit per test 256 megabytes input standard inpu ...

  4. ORA-00494: enqueue [CF] held for too long (more than 900 seconds) by 'inst 1, osid 5166'

    凌晨收到同事电话,反馈应用程序访问Oracle数据库时报错,当时现场现象确认: 1. 应用程序访问不了数据库,使用SQL Developer测试发现访问不了数据库.报ORA-12570 TNS:pac ...

  5. cf之路,1,Codeforces Round #345 (Div. 2)

     cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅.....   ...

  6. cf Round 613

    A.Peter and Snow Blower(计算几何) 给定一个点和一个多边形,求出这个多边形绕这个点旋转一圈后形成的面积.保证这个点不在多边形内. 画个图能明白 这个图形是一个圆环,那么就是这个 ...

  7. ARC下OC对象和CF对象之间的桥接(bridge)

    在开发iOS应用程序时我们有时会用到Core Foundation对象简称CF,例如Core Graphics.Core Text,并且我们可能需要将CF对象和OC对象进行互相转化,我们知道,ARC环 ...

  8. [Recommendation System] 推荐系统之协同过滤(CF)算法详解和实现

    1 集体智慧和协同过滤 1.1 什么是集体智慧(社会计算)? 集体智慧 (Collective Intelligence) 并不是 Web2.0 时代特有的,只是在 Web2.0 时代,大家在 Web ...

  9. CF memsql Start[c]UP 2.0 A

    CF memsql Start[c]UP 2.0 A A. Golden System time limit per test 1 second memory limit per test 256 m ...

随机推荐

  1. 【dfs】【高斯消元】【异或方程组】bzoj1770 [Usaco2009 Nov]lights 燈 / bzoj2466 [中山市选2009]树

    经典的开关灯问题. 高斯消元后矩阵对角线B[i][i]若是0,则第i个未知数是自由元(S个),它们可以任意取值,而让非自由元顺应它们,得到2S组解. 枚举自由元取0/1,最终得到最优解. 不知为何正着 ...

  2. C语言实现汉诺塔问题

    代码如下: #include <stdio.h> #include <stdlib.h> void move(int n,char x,char y,char z) { ) { ...

  3. Redis核心解读

    http://www.wzxue.com/redis核心解读/

  4. Android修改状态栏颜色全方位教程

    关键字:状态栏着色 透明状态栏 沉浸式 白底黑字 Github Demo:https://github.com/imflyn/Eyes 参考文章: Android-transulcent-status ...

  5. 《Javascript高级程序设计》的一些可疑点

    1.null和undefined的区别(出自第三章基本概念的3.4数据类型) 2.sort-比较函数(5.2.5重排序方法)

  6. kettle新手教程

     1.kettle介绍 kettle是一个ETL(Extract, Transform and Load抽取.转换.加载)工具,ETL工具在数据仓库项目使用很频繁,kettle也能够应用在下面一些 ...

  7. iOS:扩展UIColor,支持十六进制颜色设置

    来自转载:http://my.oschina.net/leejan97/blog/307491 摘要: 可以直接使用十六进制设置控件的颜色,而不必通过除以255.0进行转换 #define UICol ...

  8. dx12 memory management

    https://msdn.microsoft.com/en-us/library/windows/desktop/dn508285(v=vs.85).aspx Map with D3D11_MAP_W ...

  9. mysql 5.7 安装手册(for linux)

    1.下载和解压mysql数据库   wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.9-linux-glibc2.5-x86_6 ...

  10. ChannelHandlerContext writeAndFlush(firstMessage)