日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 人文社科 > 生活经验 >内容正文

生活经验

cf #363 b

發(fā)布時間:2023/11/27 生活经验 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 cf #363 b 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
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[1005][1005];
int main(){int n,m;int x=-1;int y=-1;int hang[1005];int lie[1005];int cnt=0;scanf("%d%d",&m,&n);for(int i=0;i<m;i++) hang[i]=0;for(int j=0;j<n;j++) lie[j]=0;for(int i=0;i<m;i++){scanf("%s",ma[i]);}for(int i=0;i<m;i++){for(int j=0;j<n;j++){if(ma[i][j]=='*'){hang[i]++;lie[j]++;cnt++;}}}for(int i=0;i<m;i++){for(int j=0;j<n;j++){int tmp=hang[i]+lie[j];if(ma[i][j]=='*') tmp--;if(tmp==cnt){printf("YES\n%d %d",i+1,j+1);return 0;}}}printf("NO\n");return 0;
}
View Code

分別統(tǒng)計行和列中到墻的個數(shù),如果某個 行和列中包含全部到墻,則為答案。

轉載于:https://www.cnblogs.com/superxuezhazha/p/5690607.html

總結

以上是生活随笔為你收集整理的cf #363 b的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。