Codeforces #363(Div.2) B.One Bomb

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 output standard outputYou are given a description of a depot. It is a rectangular checkered fie 阅读详情

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 triggeringexactly 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

思路:暴力 行列数相加等于总数或总数+1;不要用奇奇怪怪的方法!!不要用奇奇怪怪的方法!!不要用奇奇怪怪的方法!!!!!

代码:



#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>

using namespace std;

char a[1000+5][1000+5];
int vish[1000 + 5],visl[1000 + 5];
int main()
{

    int n,m,sum = 0;
    cin>>n>>m;
    memset(vish,0,sizeof vish);
    memset(visl,0,sizeof visl);
    for(int i = 1; i <= n; i++)
    {
        for(int j = 1; j <= m; j++)
        {

            cin>>a[i][j];
            if(a[i][j] == '*')
            {
                vish[i]++;
                visl[j]++;
                sum++;
            }
        }

    }

    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= m; j++)
            if(a[i][j]=='*' && sum == vish[i]-1+visl[j])
            {
                cout<<"YES"<<endl<<i<<" "<<j<<endl;
                return 0;
            }
            else if(a[i][j] != '*' && sum == vish[i]+visl[j])
             {
                cout<<"YES"<<endl<<i<<" "<<j<<endl;
                return 0;
            }

    cout<<"NO"<<endl;
    return 0;
}





MFC 修改CheckBox的文本颜色方法 设置主题 这一步是必须的,不可省略。 BOOL CMFCApplication1Dlg::OnInitDialog() { CDialogEx::OnInitDialog(); // 设置此对话框的图标。 当应用程序主窗口不是对话框时,框架将自动 // 执行此操作 SetIcon(m_hIcon, TRUE); // 设置大图标 SetIcon(m_hIcon, FALSE); // 设置小图标 // TODO: 在此添加额外的初始化代码 // 设置主题 HWND 阅读详情

相关推荐

Qt图形视图框架实战:QGraphicsScene、QGraphicsView与QGraphicsItem的深度应用

本文深入解析Qt图形视图框架的核心组件QGraphicsScene、QGraphicsView与QGraphicsItem的实战应用。通过“舞台、镜头与演员”的比喻,清晰阐述了三者的协作关系,并详细介绍了场景管理、多视图同步、交互增强、自定义图形项绘制与性能优化等高级技巧,帮助开发者高效构建复杂的交互式图形界面。

weixin_29251337的博客 263

Codeforces699B One Bomb 暴力

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

Megumin的博客 543

制造业私有化LLM部署实战:从RAG到智能体,构建企业专属知识大脑

大型语言模型(LLM)作为人工智能的核心技术,通过在海量文本数据上进行预训练,具备了强大的语言理解和生成能力。其原理在于基于Transformer架构,通过自注意力机制捕捉长距离语义依赖。这一技术价值在于能将非结构化信息转化为可计算、可推理的知识,从而赋能企业实现知识的高效管理与应用。在制造业等强数据安全与知识密集型领域,私有化部署的LLM结合检索增强生成(RAG)和智能体(Agent)技术,能够深入业务流程,构建安全、专属的智能知识中枢。本文聚焦于如何利用Qwen、LangChain、向量数据库等技术栈,

weixin_42523711的博客 250

CodeForces-699B One Bomb 暴力搜索

One Bomb 题目描述: You are given a description of a depot. It is a rectangular checkered field of n × msize. Each cell in a field can be empty (".") or it can be occupied by a wall ("*"). You have

Fluence_YHL 306

别再死磕USB HID了!用ESP32的Arduino框架手把手教你实现蓝牙鼠标键盘(附完整代码)

本文详细介绍了如何使用ESP32的Arduino框架实现蓝牙HID设备,包括鼠标和键盘的快速开发。通过现成的库和示例代码,开发者可以轻松打造自定义蓝牙外设,无需复杂的USB HID协议栈,适用于演示控制器、宏键盘等多种场景。

weixin_31309419的博客 264

疾风气象大模型4.0白皮书

《疾风气象大模型白皮书摘要》 疾风气象大模型(J-AFM)是国内首个基于3D建模的气象智能平台,突破传统二维气象分析的局限,采用体素化技术构建"x-y-z-t"四维统一模型,实现从分钟级短临到30天跨时效的连续预测。核心技术包括:1)多源数据三维同化,融合雷达、卫星、风廓线等异构数据;2)物理约束AI解码器,嵌入能量守恒、湍流封闭等气象原理;3)行业适配插件,服务风电、光伏、航空等领域,如山地风场尾流校正、云影短临预测。平台支持批流一体推理与边缘部署,提供概率化输出和误差溯源能力,显著降

专注AI大模型,软件混淆,授权 545

codeforces 699B One Bomb

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 on

fanesemyk的博客 348

AUTOSAR汽车电子嵌入式编程精讲300篇-基于加密算法的车载CAN总线安全通信

随着科学技术的不断更新和社会文明的不断进步,汽车已经走入寻常百姓家, 成为当代社会必不可少的交通工具。伴随着互联网技术的飞速发展,汽车也不再 是一个简单的交通工具,已经逐渐发展成为一个集出行、通信、娱乐等功能于一 身的综合智能体,进而推动了车联网产业的蓬勃发展。车联网是在传统汽车的框架上安装了传感器、执行器、控制器等分布式和集 中式控制器,使汽车具备环境感知、协同控制、优化执行等功能,并通过网络技 术实现与车外环境的信息共享,给驾驶带来方便的同时也终将成为可以替代人操 作的新一代汽车[1-3]。

getusushu的博客 2592

Journey Codeforces 34D

题目链接http://codeforces.com/problemset/problem/43/D D. Journey time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard outp...

weixin_30699741的博客 181

怎样让你的论文看起来“像人写的”?只用三招直接去除AI味(附提示词)

当然如果你在实际使用中还有其他需求,比如降重润色、改写翻译等,也可以结合七哥的专业写作平台来辅助,这个高级学术平台已经内置了ChatGPT4o、ChatGPT4.1、Claude3.7、满血版DeepSeek-R1等AI大模型,帮你写文献综述、干课题申报、写论文等学术任务绝对每一点问题。比如我自己的一套学术写作平台,其中的“降重与润色”模块整合了多种GPTs应用,除了能帮助调整语言风格、避免雷同表达,还可以顺带降个重,对于提升学术文本的整体质量还是非常有用的。一、为什么用AI写出来的文章会有AI味?

智能AI让学术科研更容易 1692

Matlab波动光光学系统

波动光学是一种研究光波传播过程的理论,按照其处理的信息类型不同,可以分为相干和非相干波动光学,相干波动光学可以用作特定光学系统的分析和设计,其主要依赖物理光学和电磁波的基本原理,以及光学干涉和衍射的经验方程式,其中光波传播过程是以复数形式表示的,包括振幅和相位两个方面。近年来光学技术得到了广泛的应用和发展,波动光光学系统是其中一种重要的光学系统,它主要是利用波动光学原理,通过计算机模拟实现各种光学系统的设计、分析和优化,可应用于大气光传输、光束整形、分析系统的衍射和干涉特性,包括利用。

weixin_50547796的博客 262

【CF 699B】One Bomb(思维)

【CF 699B】One Bomb(思维) B. One Bomb time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You are giv

ACMer' 1135

Python爬虫:实时交通流量数据爬取与路况分析

随着城市化进程的不断推进,交通流量的管理与预测已成为智能交通系统的重要研究方向。交通流量数据不仅为城市交通管理提供了科学依据,还为驾驶员提供了实时路况信息,帮助其做出更加合理的出行决策。通过爬虫技术,我们可以实时获取城市的交通流量数据,从而分析路况,优化交通管理。在这篇博客中,我们将介绍如何使用Python编写一个爬虫来爬取实时交通流量数据,分析道路的交通状况。我们将使用最新的技术工具来构建爬虫,包括。

2201_76125261的博客 1268

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

题意: 3 4 .*.. .... .*.. 可以放一个炸弹,它炸整行整列,问能不能找到一个位置,一下炸掉所有'*' '*'所在的位置也能放炸弹。 #include #include #include #include #include #include #include #include #include #include #include #include #include #i

Kim0403的博客 373

怀旧版电脑GBC模拟器

再现原版GBC掌机的界面,电脑运行连游戏界面都一样大小,很怀旧,很真实,(英文版)强烈推荐,很小的文件,很难才找到的。

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

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

题目链接:http://codeforces.com/contest/699/problem/B 题解: 一开始的做法是: 统计每行每列出现‘*’的次数, 然后再根据这两组数据进行比较,试图找出答案,结果悲剧了,错了n遍…… 后来想到: 首先还是要统计每行每列出现‘*’的次数,以及‘*’出现的总次数,得到r[n]和c[m]数组,以及sum,。然后再枚举每一个格子(O(n^

A man can be destroyed, but not defeated. 351

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

Codeforces #363(Div.2)B. One Bomb【思维】

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

mengxiang000000 690

蓝牙模块HM-10手册

蓝牙模块HM-10手册,该手册对蓝牙模块HM-10进行了详细的介绍和使用方法以及一些AT指令。

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

B. One Bomb time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output You are given a description of a depot. It is a rectangular checkered field of

滴水穿石,慢慢积累,总会有成果 369

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

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

RikkaTheWorld 321

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 output standard output You are given a description of a depot. It is a

bin_gege的博客 711

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 output standard output You are given a description of a depot. It

哆啦AC梦的专栏 395

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 output standard output You are given a description of a depot. It is a

qq_18661257的专栏 640

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

暴力枚举 记录墙总数 把行 列 墙数记录 分别记录 暴力枚举每个点 与总数比较 #include<iostream> #include<cstring> #include<algorithm> #include<cmath> #include<queue> using namespace std; char maze[1100]...

HydraHuYu 330

Codeforces Round #363 (Div. 2) B. One Bomb(模拟)

分析: 挂了终测,方法没写好。 用aia_i表示第ii行有多少个∗*,bib_i表示第ii列有多少个星。 然后再去枚举炸弹放得每一个点,看去掉这个一个点的行列之后是否没有星了。 心得: 想好了思路,应该再想好简洁的写法,即使花费长时间。#include <stdio.h> #include <iostream> int a[1111], b[1111], n, m, c; char d[1

JIBANCANYANG 286

Codeforces Round #363(Div. 2) A. Launch of Collider【模拟】 && B. One Bomb【暴力】

Codeforces Round #363(Div. 2) A. Launch of Collider【模拟】 && B. One Bomb【暴力】

SaySomething 391

Codeforces Round #363 (Div. 2) B. One Bomb(思维题目)

B. One Bomb time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output You are given a description of a depot. It is a rectangular checkered field of

linlinsong—ACM界蒟水! 649
上一篇: 多校1.Abandoned country1001
下一篇: Codeforces#363 (Div. 2) C.Vacations
July_ing
博客等级 码龄11年 9粉丝 85原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值