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. 【树套树】bzoj3110 [Zjoi2013]K大数查询

    题解很多,实现起来以外地简洁.内层的区间线段树上用了标记永久化. #include<cstdio> using namespace std; #define N 50001 struct ...

  2. 【二分答案】【分块答案】【字符串哈希】【set】bzoj2946 [Poi2000]公共串

    我们二分/分块枚举答案x,暴力把除了最短的字符串以外的其他字符串的x长度子串哈希搞出来,分别扔到set里. 然后暴力枚举最短的字符串的x长度字串,查看是否在全部的set里出现过. #include&l ...

  3. 十. 图形界面(GUI)设计10.菜单

    有两种类型的菜单:下拉式菜单和弹出式菜单.本章只讨论下拉式菜单编程方法.菜单与JComboBox和JCheckBox不同,它们在界面中是一直可见的.菜单与JComboBox的相同之处是每次只可选择一个 ...

  4. 使用IDEA创建package

    1)使用IDEA创建java工程 什么也不选,直接点击Next 无脑继续下一步 点击“Finish”完成工程的创建. 2)在使用IDEA创建了工程之后,首先选中“src”文件夹,然后 紧接着输入包名 ...

  5. Java高级架构师(一)第11节:Mybatis的分页实现

  6. access日志配置

    链接地址:  https://wenku.baidu.com/view/3e20fac758f5f61fb73666cf.html org.apache.catalina.valves.AccessL ...

  7. JNI之常用函数大全

    要素  :1. 该函数大全是基于C语言方式的,对于C++方式可以直接转换 ,例如,对于生成一个jstring类型的方法转换分别如下: C编程环境中使用方法为:(*env) ->NewString ...

  8. Android 智能指针学习 一

    Android5.1 中智能指针涉及的文件如下: system/core/include/utils/RefBase.h system/core/libutils/RefBase.cpp system ...

  9. linux tail 命令详解!Linux 文件内容查看工具介绍

    转:http://blog.csdn.net/carzyer/article/details/4759593 1.cat 显示文件连接文件内容的工具: cat 是一个文本文件查看和连接工具.查看一个文 ...

  10. JAVA常见算法题(二十六)

    package com.xiaowu.demo; import java.util.Scanner; /** * Java实现将阿拉伯数字转为汉字 * * @author WQ * */ public ...